Fix check-cherry-picks.sh empty commit_hash argument
When the patch is not a merge commit, commit_hash is empty.
Quoting it as "${commit_hash}" passes an explicit empty string
to git show, causing:
fatal: ambiguous argument '': unknown revision or path not
in the working tree.
Remove quotes so the empty variable expands to nothing, letting
git show default to HEAD. Also align grep flag with the upstream
Nova version (-qi instead of -qxi).
Change-Id: I6b7b06b03999532189d58e8c0d2042f75d05f8b8
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
@@ -14,12 +14,12 @@ if [ $parent_number -eq 2 ]; then
|
||||
commit_hash=$(git show --format='%P' --quiet | awk '{print $NF}')
|
||||
fi
|
||||
|
||||
if git show --format='%aE' --quiet "${commit_hash}" | grep -qxi 'infra-root@openstack.org'; then
|
||||
if git show --format='%aE' --quiet ${commit_hash} | grep -qi 'infra-root@openstack.org'; then
|
||||
echo 'Bot generated change; ignoring'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
hashes=$(git show --format='%b' --quiet "${commit_hash}" | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
|
||||
hashes=$(git show --format='%b' --quiet ${commit_hash} | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
|
||||
checked=0
|
||||
branches+=""
|
||||
for hash in $hashes; do
|
||||
@@ -40,7 +40,7 @@ if [ $checked -eq 0 ]; then
|
||||
echo "Checked $checked cherry-pick hashes: OK"
|
||||
exit 0
|
||||
else
|
||||
if ! git show --format='%B' --quiet "${commit_hash}" | grep -qi 'stable.*only'; then
|
||||
if ! git show --format='%B' --quiet ${commit_hash} | grep -qi 'stable.*only'; then
|
||||
echo 'Stable branch requires either cherry-pick -x headers or [stable-only] tag!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user