git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
AGAllen Reese via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 10, 2023, 17:01 UTC
Message-ID
<01d69fc9f12197eb43cf48b3d7eff9a40f04e51b.1681146107.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1490.git.git.1681146107.gitgitgadget@gmail.com>
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 --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)
-- 
gitgitgadget
Previous: Allen Reese via GitGitGadgetNext: Jacques Vidrine via GitGitGadget
Message 2 of 4 in “subtree: support GPG commit signing”
  1. 0/2 subtree: support GPG commit signingAllen Reese via GitGitGadget, Apr 10, 2023
  2. 2/2 contrib/subtree: fix gpg_sign_arg not being passed to git merge.Allen Reese via GitGitGadget, Apr 10, 2023
  3. 1/2 subtree: support GPG commit signingJacques Vidrine via GitGitGadget, Apr 10, 2023
  4. Allen ReeseApr 10, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.