git-coauthor: quote variable in the comparison

This commit is contained in:
spacewander 2019-12-20 18:22:06 +08:00
parent eb33c9bf5a
commit ecff5e1a3c

View file

@ -9,7 +9,7 @@ test -z "$coauthor" && echo "co-author required." 1>&2 && exit 1
test -z "$email" && echo "co-author email required." 1>&2 && exit 1
old_message="$(git log --format=%B -n1)"
if [[ $old_message == *"Co-authored-by:"* ]]; then
if [[ "$old_message" == *"Co-authored-by:"* ]]; then
git commit --amend -m "$old_message
Co-authored-by: $coauthor <$email>"
else