Skip to contentSkip to conversation

scripts: check fixed commit branch

PATCH Applied Thomas Monjalon 1 participant 2 messages Jun 29, 2016 – Jul 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: check fixed commit branch

The commit id of a fixed commit must be in the current branch. It avoids referencing a local branch or a next-* branch when pushing in the master.

---
 scripts/check-git-log.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/check-git-log.sh +5 -1
index 9a0d068..7d2c7ee 100755
@@ -140,7 +140,11 @@ IFS='
 fixtags=$(echo "$tags" | grep '^Fixes: ')
 bad=$(for fixtag in $fixtags ; do
 	hash=$(echo "$fixtag" | sed 's,^Fixes: \([0-9a-f]*\).*,\1,')
-	good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-)
+	if git branch --contains $hash | grep -q '^\*' ; then
+		good="Fixes: $hash "$(git log --format='("%s")' -1 $hash 2>&-)
+	else
+		good="reference not in current branch"
+	fi
 	printf "$fixtag" | grep -v "^$good$"
 done | sed 's,^,\t,')
 [ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n"
Signature · 1 line
2.7.0
author Applied
#1 lore raw

2016-06-29 16:47, Thomas Monjalon:

Quoted 5 lines

The commit id of a fixed commit must be in the current branch. It avoids referencing a local branch or a next-* branch when pushing in the master.

Applied