From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Felix Lechner <felix.lechner@lease-up.com>
Cc: Giovanni Biscuolo <g@xelera.eu>,
Simon Tournier <zimon.toutoune@gmail.com>,
guix-devel@gnu.org
Subject: Re: [workflow] Automatically close bug report when a patch is committed
Date: Thu, 07 Sep 2023 09:09:30 -0400 [thread overview]
Message-ID: <877cp2nn91.fsf@gmail.com> (raw)
In-Reply-To: <CAFHYt56W7AU6oA1YoB8pm9jjDxiCC9N0nr4rhnsYJbo2ys+ciA@mail.gmail.com> (Felix Lechner's message of "Thu, 7 Sep 2023 04:58:03 -0700")
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
Hi,
Felix Lechner <felix.lechner@lease-up.com> writes:
> Hi Gio',
>
> On Thu, Sep 7, 2023 at 4:08 AM Giovanni Biscuolo <g@xelera.eu> wrote:
>>
>> close the bugs that are listed in
>> the commit message
>
> Perhaps you'd like to see Debian's hook [1] for the Salsa web forge
> (which is controversially based on Gitlab).
>
> The regex does not work properly for more than two bugs, however, so
> here is my proposed fix. [2] The merge request was closed
> automatically when I began contributing to Guix.
Did you see my message about integrating a commit-hook similar to what
Gerrit uses? It produces unique ID such as:
--8<---------------cut here---------------start------------->8---
Change-Id: I9b86781869d80eda347659f0c009b8dfe09bdfd0
--8<---------------cut here---------------end--------------->8---
at the bottom (it's a git trailer) of a commit message. Being unique,
these could be used to match if a patch on the tracker has been merged
in the master branch.
Attached is what the hook looks like. The random 'Change-Id' is
generated via
--8<---------------cut here---------------start------------->8---
random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } |
git hash-object --stdin)
--8<---------------cut here---------------end--------------->8---
[-- Attachment #2: commit-msg --]
[-- Type: application/octet-stream, Size: 2272 bytes --]
#!/bin/sh
# From Gerrit Code Review 3.6.1
#
# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -u
# avoid [[ which is not POSIX sh.
if test "$#" != 1 ; then
echo "$0 requires an argument."
exit 1
fi
if test ! -f "$1" ; then
echo "file does not exist: $1"
exit 1
fi
# Do not create a change id if requested
if test "false" = "$(git config --bool --get gerrit.createChangeId)" ; then
exit 0
fi
if git rev-parse --verify HEAD >/dev/null 2>&1; then
refhash="$(git rev-parse HEAD)"
else
refhash="$(git hash-object -t tree /dev/null)"
fi
random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } | git hash-object --stdin)
dest="$1.tmp.${random}"
trap 'rm -f "${dest}"' EXIT
if ! git stripspace --strip-comments < "$1" > "${dest}" ; then
echo "cannot strip comments from $1"
exit 1
fi
if test ! -s "${dest}" ; then
echo "file is empty: $1"
exit 1
fi
reviewurl="$(git config --get gerrit.reviewUrl)"
if test -n "${reviewurl}" ; then
if ! git interpret-trailers --parse < "$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$' ; then
if ! git interpret-trailers \
--trailer "Link: ${reviewurl%/}/id/I${random}" < "$1" > "${dest}" ; then
echo "cannot insert link footer in $1"
exit 1
fi
fi
else
# Avoid the --in-place option which only appeared in Git 2.8
# Avoid the --if-exists option which only appeared in Git 2.15
if ! git -c trailer.ifexists=doNothing interpret-trailers \
--trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then
echo "cannot insert change-id line in $1"
exit 1
fi
fi
if ! mv "${dest}" "$1" ; then
echo "cannot mv ${dest} to $1"
exit 1
fi
[-- Attachment #3: Type: text/plain, Size: 19 bytes --]
--
Thanks,
Maxim
next prev parent reply other threads:[~2023-09-07 13:12 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 8:28 [workflow] Automatically close bug report when a patch is committed Giovanni Biscuolo
2023-09-06 9:45 ` Christopher Baines
2023-09-07 9:38 ` [workflow] Triaging issues (was Automatically close bug report when a patch is committed) Giovanni Biscuolo
2023-09-07 15:41 ` Vagrant Cascadian
2023-09-11 7:37 ` Giovanni Biscuolo
2023-09-11 15:29 ` Simon Tournier
2023-09-11 17:08 ` Giovanni Biscuolo
2023-09-06 16:14 ` [workflow] Automatically close bug report when a patch is committed Maxim Cournoyer
2023-09-07 0:23 ` Simon Tournier
2023-09-07 2:01 ` Maxim Cournoyer
2023-09-07 9:58 ` Simon Tournier
2023-09-09 23:43 ` Maxim Cournoyer
2023-09-07 13:11 ` Giovanni Biscuolo
2023-09-09 23:39 ` Maxim Cournoyer
2023-09-11 7:53 ` Giovanni Biscuolo
2023-09-11 14:01 ` Maxim Cournoyer
2023-09-11 17:10 ` Giovanni Biscuolo
2023-09-07 11:08 ` Giovanni Biscuolo
2023-09-07 11:58 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2023-09-07 13:09 ` Maxim Cournoyer [this message]
2023-09-07 15:52 ` Vagrant Cascadian
2023-09-09 23:50 ` Maxim Cournoyer
2023-09-11 11:00 ` Simon Tournier
2023-09-11 13:46 ` Maxim Cournoyer
2023-09-11 14:11 ` Simon Tournier
2023-09-11 15:33 ` Maxim Cournoyer
2023-09-13 2:46 ` Vagrant Cascadian
2023-09-13 15:49 ` Maxim Cournoyer
2023-09-14 16:30 ` Vagrant Cascadian
2023-09-14 18:02 ` Maxim Cournoyer
2023-09-07 13:19 ` Giovanni Biscuolo
2023-09-07 10:40 ` Giovanni Biscuolo
2023-09-07 13:49 ` Giovanni Biscuolo
2023-09-27 14:36 ` Christopher Baines
2023-09-07 16:12 ` Vagrant Cascadian
2023-09-07 16:28 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2023-09-09 23:59 ` Liliana Marie Prikler
2023-09-11 8:09 ` Giovanni Biscuolo
2023-09-11 13:59 ` Maxim Cournoyer
2023-09-11 17:55 ` Liliana Marie Prikler
2023-09-11 18:36 ` Maxim Cournoyer
2023-09-11 18:51 ` Liliana Marie Prikler
2023-09-11 20:41 ` Maxim Cournoyer
2023-09-12 13:55 ` Giovanni Biscuolo
2023-09-13 15:19 ` Maxim Cournoyer
2023-09-14 9:42 ` Giovanni Biscuolo
2023-09-14 16:58 ` Liliana Marie Prikler
2023-09-12 17:03 ` Liliana Marie Prikler
2023-09-13 9:37 ` Giovanni Biscuolo
2023-09-13 15:27 ` Maxim Cournoyer
2023-09-13 19:14 ` Liliana Marie Prikler
2023-09-13 22:12 ` Simon Tournier
2023-09-14 3:00 ` Maxim Cournoyer
2023-09-14 10:48 ` Giovanni Biscuolo
2023-09-15 21:46 ` Vagrant Cascadian
2023-09-19 16:41 ` Giovanni Biscuolo
2023-09-14 10:27 ` Giovanni Biscuolo
2023-09-14 12:25 ` Simon Tournier
2023-09-15 7:16 ` Giovanni Biscuolo
2023-09-15 9:03 ` Simon Tournier
2023-09-15 14:37 ` The already complicated (complex?) process for contributing Giovanni Biscuolo
2023-09-15 16:43 ` Simon Tournier
2023-09-16 7:33 ` Giovanni Biscuolo
2023-09-16 8:33 ` Simon Tournier
2023-09-14 7:20 ` [workflow] Automatically close bug report when a patch is committed Andreas Enge
2023-09-14 10:25 ` Giovanni Biscuolo
2023-09-14 22:51 ` Vagrant Cascadian
2023-09-15 4:23 ` Liliana Marie Prikler
2023-09-15 21:30 ` Vagrant Cascadian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cp2nn91.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=felix.lechner@lease-up.com \
--cc=g@xelera.eu \
--cc=guix-devel@gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.