summaryrefslogtreecommitdiff
path: root/etc/git
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2026-05-29 14:08:33 +0900
committerMaxim Cournoyer <maxim@guixotic.coop>2026-05-29 14:09:15 +0900
commit39baeaa58fea76fe322d271c3e7451f4923d0e2b (patch)
tree42ec355f8c32de5944c061d9e75f3a0d8a9c9fde /etc/git
parentf9a815858082dff541f1ce5ac22cbc2f5b5faf80 (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-xetc/git/commit-msg11
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
71trap 'rm -f "$dest" "$dest-2"' EXIT 70trap 'rm -f "$dest" "$dest-2"' EXIT
72 71
73if ! cat "$1" | sed -e '/>8/q' | git stripspace --strip-comments > "${dest}" ; then 72if ! 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
76fi 75fi
77 76
78if test ! -s "${dest}" ; then 77if test ! -s "${dest}" ; then
@@ -91,7 +90,7 @@ else
91 pattern=".*" 90 pattern=".*"
92fi 91fi
93 92
94if git interpret-trailers --parse < "$1" | grep -q "^$token: $pattern$" ; then 93if git interpret-trailers --no-divider --parse < "$1" | grep -q "^$token: $pattern$" ; then
95 exit 0 94 exit 0
96fi 95fi
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
101if ! git interpret-trailers \ 100if ! 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
112if ! git -c trailer.where=before interpret-trailers \ 112if ! 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