diff mbox series

[2/2] contrib/subtree: fix gpg_sign_arg not being passed to git merge.

Message ID 01d69fc9f12197eb43cf48b3d7eff9a40f04e51b.1681146107.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series subtree: support GPG commit signing | expand

Commit Message

Allen Reese April 10, 2023, 5:01 p.m. UTC
From: Allen Reese <allen_reese@apple.com>

Replace immitate -> imitate.

cc: Avery apenwarr@gmail.com

Signed-off-by: Allen Reese <allen_reese@apple.com>
---
 contrib/subtree/git-subtree.sh     | 14 +++++++++++---
 contrib/subtree/t/t7900-subtree.sh |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 553b4391deb..18dc7f8a4c2 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -243,8 +243,16 @@  main () {
 			test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
 			arg_addmerge_squash=
 			;;
-		-S*|--gpg-sign=*|--no-gpg-sign)
+		-S|--gpg-sign|--no-gpg-sign)
 			arg_gpgsign="${opt}"
+			case $1 in
+				-*)
+					;;
+				*)
+					arg_gpgsign=${opt}${1}
+					shift
+					;;
+			esac
 			;;
 		--)
 			break
@@ -1053,10 +1061,10 @@  cmd_merge () {
 
 	if test -n "$arg_addmerge_message"
 	then
-		git merge --no-ff -Xsubtree="$arg_prefix" \
+		git merge --no-ff $arg_gpgsign -Xsubtree="$arg_prefix" \
 			--message="$arg_addmerge_message" "$rev"
 	else
-		git merge --no-ff -Xsubtree="$arg_prefix" $rev
+		git merge --no-ff $arg_gpgsign -Xsubtree="$arg_prefix" $rev
 	fi
 }
 
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 341c169eca7..fa5bd9b7af6 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -47,7 +47,7 @@  last_commit_subject () {
 # pre-2.32.0 versions of 'git subtree' would write the hash of the tag
 # (sub1 below), instead of the commit (sub1^{commit}) in the
 # "git-subtree-split" trailer.
-# We immitate this behaviour below using a replace ref.
+# We imitate this behaviour below using a replace ref.
 # This function creates 3 repositories:
 # - $1
 # - $1-sub (added as subtree "sub" in $1)