From b647da1064d88d1c5104e918b960a3f97f154ca9 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Wed, 29 Jun 2016 16:39:50 +0200 Subject: [PATCH] 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. Signed-off-by: Thomas Monjalon --- scripts/check-git-log.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/check-git-log.sh b/scripts/check-git-log.sh index 9a0d0683ff..7d2c7ee83b 100755 --- a/scripts/check-git-log.sh +++ b/scripts/check-git-log.sh @@ -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" -- 2.20.1