diff options
| author | Maxim Cournoyer <maxim@guixotic.coop> | 2026-05-29 14:08:33 +0900 |
|---|---|---|
| committer | Maxim Cournoyer <maxim@guixotic.coop> | 2026-05-29 14:09:15 +0900 |
| commit | 39baeaa58fea76fe322d271c3e7451f4923d0e2b (patch) | |
| tree | 42ec355f8c32de5944c061d9e75f3a0d8a9c9fde /etc/git | |
| parent | f9a815858082dff541f1ce5ac22cbc2f5b5faf80 (diff) | |
Update commit-msg hook.
Retrieved from <https://gerrit.googlesource.com/gerrit/+/refs/heads/master/resources/com/google/gerrit/server/tools/root/hooks/commit-msg>.
Fixes: <https://issues.guix.gnu.org/81044>
Change-Id: Ia0bbc6fac3354df6162c813fe94c344a041ffbaf
Reported-by: Tomas Volf <~@wolfsden.cz>
Diffstat (limited to 'etc/git')
| -rwxr-xr-x | etc/git/commit-msg | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/etc/git/commit-msg b/etc/git/commit-msg index 69bd1fcde18..7175c158123 100755 --- a/etc/git/commit-msg +++ b/etc/git/commit-msg | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # From Gerrit Code Review 3.11.1. | ||
| 3 | # | 2 | # |
| 4 | # Part of Gerrit Code Review (https://www.gerritcodereview.com/) | 3 | # Part of Gerrit Code Review (https://www.gerritcodereview.com/) |
| 5 | # | 4 | # |
| @@ -70,9 +69,9 @@ dest="$1.tmp.${random}" | |||
| 70 | 69 | ||
| 71 | trap 'rm -f "$dest" "$dest-2"' EXIT | 70 | trap 'rm -f "$dest" "$dest-2"' EXIT |
| 72 | 71 | ||
| 73 | if ! cat "$1" | sed -e '/>8/q' | git stripspace --strip-comments > "${dest}" ; then | 72 | if ! sed -e '/>8/q' "$1" | git stripspace --strip-comments > "${dest}" ; then |
| 74 | echo "cannot strip comments from $1" | 73 | echo "cannot strip comments from $1" |
| 75 | exit 1 | 74 | exit 1 |
| 76 | fi | 75 | fi |
| 77 | 76 | ||
| 78 | if test ! -s "${dest}" ; then | 77 | if test ! -s "${dest}" ; then |
| @@ -91,7 +90,7 @@ else | |||
| 91 | pattern=".*" | 90 | pattern=".*" |
| 92 | fi | 91 | fi |
| 93 | 92 | ||
| 94 | if git interpret-trailers --parse < "$1" | grep -q "^$token: $pattern$" ; then | 93 | if git interpret-trailers --no-divider --parse < "$1" | grep -q "^$token: $pattern$" ; then |
| 95 | exit 0 | 94 | exit 0 |
| 96 | fi | 95 | fi |
| 97 | 96 | ||
| @@ -99,6 +98,7 @@ fi | |||
| 99 | # sentinel at the end to make sure there is one. | 98 | # sentinel at the end to make sure there is one. |
| 100 | # Avoid the --in-place option which only appeared in Git 2.8 | 99 | # Avoid the --in-place option which only appeared in Git 2.8 |
| 101 | if ! git interpret-trailers \ | 100 | if ! git interpret-trailers \ |
| 101 | --no-divider \ | ||
| 102 | --trailer "Signed-off-by: SENTINEL" < "$1" > "$dest-2" ; then | 102 | --trailer "Signed-off-by: SENTINEL" < "$1" > "$dest-2" ; then |
| 103 | echo "cannot insert Signed-off-by sentinel line in $1" | 103 | echo "cannot insert Signed-off-by sentinel line in $1" |
| 104 | exit 1 | 104 | exit 1 |
| @@ -110,6 +110,7 @@ fi | |||
| 110 | # Avoid the --in-place option which only appeared in Git 2.8 | 110 | # Avoid the --in-place option which only appeared in Git 2.8 |
| 111 | # Avoid the --where option which only appeared in Git 2.15 | 111 | # Avoid the --where option which only appeared in Git 2.15 |
| 112 | if ! git -c trailer.where=before interpret-trailers \ | 112 | if ! git -c trailer.where=before interpret-trailers \ |
| 113 | --no-divider \ | ||
| 113 | --trailer "Signed-off-by: $token: $value" < "$dest-2" | | 114 | --trailer "Signed-off-by: $token: $value" < "$dest-2" | |
| 114 | sed -e "s/^Signed-off-by: \($token: \)/\1/" \ | 115 | sed -e "s/^Signed-off-by: \($token: \)/\1/" \ |
| 115 | -e "/^Signed-off-by: SENTINEL/d" > "$dest" ; then | 116 | -e "/^Signed-off-by: SENTINEL/d" > "$dest" ; then |
