{"thread":{"id":"59571","subject":"[PATCH 0/2] subtree: support GPG commit signing","startedAt":"2023-04-10T17:01:53Z","lastAt":"2023-04-10T19:00:18Z","messageCount":4,"participants":["Allen Reese via GitGitGadget","Jacques Vidrine via GitGitGadget","Allen Reese"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"475070","messageId":"pull.1490.git.git.1681146107.gitgitgadget@gmail.com","threadId":"59571","inReplyTo":null,"subject":"[PATCH 0/2] subtree: support GPG commit signing","fromName":"Allen Reese via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-10T17:01:45Z","receivedAt":"2023-04-10T17:01:53Z","isPatch":true,"sender":{"key":"java.allen@apple.com","avatar":null},"body":"Add support for -S/--gpg-sign/--no-gpg-sign command line options and\ncommit.gpgsign configuration. These are passed to invocations of git\ncommit-tree.\n\ncc: Avery apenwarr@gmail.com\n\nAllen Reese (1):\n  contrib/subtree: fix gpg_sign_arg not being passed to git merge.\n\nJacques Vidrine (1):\n  subtree: support GPG commit signing\n\n contrib/subtree/git-subtree.sh     | 36 ++++++++++++++++++++++++------\n contrib/subtree/git-subtree.txt    |  9 ++++++++\n contrib/subtree/t/t7900-subtree.sh |  2 +-\n 3 files changed, 39 insertions(+), 8 deletions(-)\n\n\nbase-commit: 0607f793cbe0af16aee6d2480056d891835884bd\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1490%2Fareese%2Fgit-subtree-support-gpg-signing-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1490/areese/git-subtree-support-gpg-signing-v1\nPull-Request: https://github.com/git/git/pull/1490\n-- \ngitgitgadget\n"},{"id":"475071","messageId":"01d69fc9f12197eb43cf48b3d7eff9a40f04e51b.1681146107.git.gitgitgadget@gmail.com","threadId":"59571","inReplyTo":"pull.1490.git.git.1681146107.gitgitgadget@gmail.com","subject":"[PATCH 2/2] contrib/subtree: fix gpg_sign_arg not being passed to git merge.","fromName":"Allen Reese via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-10T17:01:47Z","receivedAt":"2023-04-10T17:01:55Z","isPatch":true,"sender":{"key":"java.allen@apple.com","avatar":null},"body":"From: Allen Reese <allen_reese@apple.com>\n\nReplace immitate -> imitate.\n\ncc: Avery apenwarr@gmail.com\n\nSigned-off-by: Allen Reese <allen_reese@apple.com>\n---\n contrib/subtree/git-subtree.sh     | 14 +++++++++++---\n contrib/subtree/t/t7900-subtree.sh |  2 +-\n 2 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 553b4391deb..18dc7f8a4c2 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -243,8 +243,16 @@ main () {\n \t\t\ttest -n \"$allow_addmerge\" || die_incompatible_opt \"$opt\" \"$arg_command\"\n \t\t\targ_addmerge_squash=\n \t\t\t;;\n-\t\t-S*|--gpg-sign=*|--no-gpg-sign)\n+\t\t-S|--gpg-sign|--no-gpg-sign)\n \t\t\targ_gpgsign=\"${opt}\"\n+\t\t\tcase $1 in\n+\t\t\t\t-*)\n+\t\t\t\t\t;;\n+\t\t\t\t*)\n+\t\t\t\t\targ_gpgsign=${opt}${1}\n+\t\t\t\t\tshift\n+\t\t\t\t\t;;\n+\t\t\tesac\n \t\t\t;;\n \t\t--)\n \t\t\tbreak\n@@ -1053,10 +1061,10 @@ cmd_merge () {\n \n \tif test -n \"$arg_addmerge_message\"\n \tthen\n-\t\tgit merge --no-ff -Xsubtree=\"$arg_prefix\" \\\n+\t\tgit merge --no-ff $arg_gpgsign -Xsubtree=\"$arg_prefix\" \\\n \t\t\t--message=\"$arg_addmerge_message\" \"$rev\"\n \telse\n-\t\tgit merge --no-ff -Xsubtree=\"$arg_prefix\" $rev\n+\t\tgit merge --no-ff $arg_gpgsign -Xsubtree=\"$arg_prefix\" $rev\n \tfi\n }\n \ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 341c169eca7..fa5bd9b7af6 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -47,7 +47,7 @@ last_commit_subject () {\n # pre-2.32.0 versions of 'git subtree' would write the hash of the tag\n # (sub1 below), instead of the commit (sub1^{commit}) in the\n # \"git-subtree-split\" trailer.\n-# We immitate this behaviour below using a replace ref.\n+# We imitate this behaviour below using a replace ref.\n # This function creates 3 repositories:\n # - $1\n # - $1-sub (added as subtree \"sub\" in $1)\n-- \ngitgitgadget\n"},{"id":"475072","messageId":"ffbdcf9db686cdd786e21add6ca194c2dbdafa3b.1681146107.git.gitgitgadget@gmail.com","threadId":"59571","inReplyTo":"pull.1490.git.git.1681146107.gitgitgadget@gmail.com","subject":"[PATCH 1/2] subtree: support GPG commit signing","fromName":"Jacques Vidrine via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-10T17:01:46Z","receivedAt":"2023-04-10T17:01:57Z","isPatch":true,"sender":{"key":"name:Jacques Vidrine","avatar":null},"body":"From: Jacques Vidrine <t@fboundp.com>\n\nAdd support for -S/--gpg-sign/--no-gpg-sign command line options\nand commit.gpgsign configuration. These are passed to invocations\nof `git commit-tree`.\n\nSigned-off-by: Allen Reese <java.allen@apple.com>\nSigned-off-by: Jacques Vidrine <t@fboundp.com>\n---\n contrib/subtree/git-subtree.sh  | 24 +++++++++++++++++++-----\n contrib/subtree/git-subtree.txt |  9 +++++++++\n 2 files changed, 28 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 10c9c87839a..553b4391deb 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -46,6 +46,8 @@ rejoin        merge the new branch back into HEAD\n  options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin')\n squash        merge subtree changes as a single commit\n m,message=    use the given message as the commit message for the merge commit\n+S,gpg-sign?   GPG-sign commits, optionally specifying keyid.\n+no-gpg-sign   Disable GPG commit signing.\n \"\n \n indent=0\n@@ -165,6 +167,7 @@ main () {\n \targ_quiet=\n \targ_debug=\n \targ_prefix=\n+\targ_gpgsign=\n \targ_split_branch=\n \targ_split_onto=\n \targ_split_ignore_joins=\n@@ -240,6 +243,9 @@ main () {\n \t\t\ttest -n \"$allow_addmerge\" || die_incompatible_opt \"$opt\" \"$arg_command\"\n \t\t\targ_addmerge_squash=\n \t\t\t;;\n+\t\t-S*|--gpg-sign=*|--no-gpg-sign)\n+\t\t\targ_gpgsign=\"${opt}\"\n+\t\t\t;;\n \t\t--)\n \t\t\tbreak\n \t\t\t;;\n@@ -268,6 +274,12 @@ main () {\n \n \tdir=\"$(dirname \"$arg_prefix/.\")\"\n \n+\tif test -z \"$arg_gpgsign\" &&\n+\t\tgit config --bool commit.gpgsign >/dev/null\n+\tthen\n+\t\targ_gpgsign=\"-S\"\n+\tfi\n+\n \tdebug \"command: {$arg_command}\"\n \tdebug \"quiet: {$arg_quiet}\"\n \tdebug \"dir: {$dir}\"\n@@ -534,7 +546,7 @@ copy_commit () {\n \t\t\tprintf \"%s\" \"$arg_split_annotate\"\n \t\t\tcat\n \t\t) |\n-\t\tgit commit-tree \"$2\" $3  # reads the rest of stdin\n+\t\tgit commit-tree $arg_gpgsign \"$2\" $3  # reads the rest of stdin\n \t) || die \"fatal: can't copy commit $1\"\n }\n \n@@ -674,10 +686,10 @@ new_squash_commit () {\n \tif test -n \"$old\"\n \tthen\n \t\tsquash_msg \"$dir\" \"$oldsub\" \"$newsub\" |\n-\t\tgit commit-tree \"$tree\" -p \"$old\" || exit $?\n+\t\tgit commit-tree $arg_gpgsign \"$tree\" -p \"$old\" || exit $?\n \telse\n \t\tsquash_msg \"$dir\" \"\" \"$newsub\" |\n-\t\tgit commit-tree \"$tree\" || exit $?\n+\t\tgit commit-tree $arg_gpgsign \"$tree\" || exit $?\n \tfi\n }\n \n@@ -900,11 +912,13 @@ cmd_add_commit () {\n \tthen\n \t\trev=$(new_squash_commit \"\" \"\" \"$rev\") || exit $?\n \t\tcommit=$(add_squashed_msg \"$rev\" \"$dir\" |\n-\t\t\tgit commit-tree \"$tree\" $headp -p \"$rev\") || exit $?\n+\t\t\tgit commit-tree $arg_gpgsign \"$tree\" \\\n+\t\t\t$headp -p \"$rev\") || exit $?\n \telse\n \t\trevp=$(peel_committish \"$rev\") || exit $?\n \t\tcommit=$(add_msg \"$dir\" $headrev \"$rev\" |\n-\t\t\tgit commit-tree \"$tree\" $headp -p \"$revp\") || exit $?\n+\t\t\tgit commit-tree $arg_gpgsign \"$tree\" \\\n+\t\t\t$headp -p \"$revp\") || exit $?\n \tfi\n \tgit reset \"$commit\" || exit $?\n \ndiff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\nindex 004abf415b8..fa54541b288 100644\n--- a/contrib/subtree/git-subtree.txt\n+++ b/contrib/subtree/git-subtree.txt\n@@ -185,6 +185,15 @@ subproject.\n --message=<message>::\n \tSpecify <message> as the commit message for the merge commit.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+--no-gpg-sign::\n+\tGPG-sign commits. The `keyid` argument is optional and\n+\tdefaults to the committer identity; if specified, it must be\n+\tstuck to the option without a space. `--no-gpg-sign` is useful to\n+\tcountermand both `commit.gpgSign` configuration variable, and\n+\tearlier `--gpg-sign`.\n+\n OPTIONS FOR 'split' (ALSO: 'push')\n ----------------------------------\n These options for 'split' may also be given to 'push' (which wraps\n-- \ngitgitgadget\n\n"},{"id":"475075","messageId":"18BB0B7B-33C1-4B7F-ABC8-2A647E5B9497@apple.com","threadId":"59571","inReplyTo":"ffbdcf9db686cdd786e21add6ca194c2dbdafa3b.1681146107.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/2] subtree: support GPG commit signing","fromName":"Allen Reese","fromEmail":"java.allen@apple.com","sentAt":"2023-04-10T17:59:59Z","receivedAt":"2023-04-10T19:00:18Z","isPatch":true,"sender":{"key":"java.allen@apple.com","avatar":null},"body":"Adding Avery, as I don’t seem to have managed to cc Avery as part of the gitgadet pr.\n\n\n\n> On Apr 10, 2023, at 10:01 AM, Jacques Vidrine via GitGitGadget <gitgitgadget@gmail.com> wrote:\n> \n> From: Jacques Vidrine <t@fboundp.com>\n> \n> Add support for -S/--gpg-sign/--no-gpg-sign command line options\n> and commit.gpgsign configuration. These are passed to invocations\n> of `git commit-tree`.\n> \n> Signed-off-by: Allen Reese <java.allen@apple.com>\n> Signed-off-by: Jacques Vidrine <t@fboundp.com>\n> ---\n> contrib/subtree/git-subtree.sh  | 24 +++++++++++++++++++-----\n> contrib/subtree/git-subtree.txt |  9 +++++++++\n> 2 files changed, 28 insertions(+), 5 deletions(-)\n> \n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 10c9c87839a..553b4391deb 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -46,6 +46,8 @@ rejoin        merge the new branch back into HEAD\n>  options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin')\n> squash        merge subtree changes as a single commit\n> m,message=    use the given message as the commit message for the merge commit\n> +S,gpg-sign?   GPG-sign commits, optionally specifying keyid.\n> +no-gpg-sign   Disable GPG commit signing.\n> \"\n> \n> indent=0\n> @@ -165,6 +167,7 @@ main () {\n> \targ_quiet=\n> \targ_debug=\n> \targ_prefix=\n> +\targ_gpgsign=\n> \targ_split_branch=\n> \targ_split_onto=\n> \targ_split_ignore_joins=\n> @@ -240,6 +243,9 @@ main () {\n> \t\t\ttest -n \"$allow_addmerge\" || die_incompatible_opt \"$opt\" \"$arg_command\"\n> \t\t\targ_addmerge_squash=\n> \t\t\t;;\n> +\t\t-S*|--gpg-sign=*|--no-gpg-sign)\n> +\t\t\targ_gpgsign=\"${opt}\"\n> +\t\t\t;;\n> \t\t--)\n> \t\t\tbreak\n> \t\t\t;;\n> @@ -268,6 +274,12 @@ main () {\n> \n> \tdir=\"$(dirname \"$arg_prefix/.\")\"\n> \n> +\tif test -z \"$arg_gpgsign\" &&\n> +\t\tgit config --bool commit.gpgsign >/dev/null\n> +\tthen\n> +\t\targ_gpgsign=\"-S\"\n> +\tfi\n> +\n> \tdebug \"command: {$arg_command}\"\n> \tdebug \"quiet: {$arg_quiet}\"\n> \tdebug \"dir: {$dir}\"\n> @@ -534,7 +546,7 @@ copy_commit () {\n> \t\t\tprintf \"%s\" \"$arg_split_annotate\"\n> \t\t\tcat\n> \t\t) |\n> -\t\tgit commit-tree \"$2\" $3  # reads the rest of stdin\n> +\t\tgit commit-tree $arg_gpgsign \"$2\" $3  # reads the rest of stdin\n> \t) || die \"fatal: can't copy commit $1\"\n> }\n> \n> @@ -674,10 +686,10 @@ new_squash_commit () {\n> \tif test -n \"$old\"\n> \tthen\n> \t\tsquash_msg \"$dir\" \"$oldsub\" \"$newsub\" |\n> -\t\tgit commit-tree \"$tree\" -p \"$old\" || exit $?\n> +\t\tgit commit-tree $arg_gpgsign \"$tree\" -p \"$old\" || exit $?\n> \telse\n> \t\tsquash_msg \"$dir\" \"\" \"$newsub\" |\n> -\t\tgit commit-tree \"$tree\" || exit $?\n> +\t\tgit commit-tree $arg_gpgsign \"$tree\" || exit $?\n> \tfi\n> }\n> \n> @@ -900,11 +912,13 @@ cmd_add_commit () {\n> \tthen\n> \t\trev=$(new_squash_commit \"\" \"\" \"$rev\") || exit $?\n> \t\tcommit=$(add_squashed_msg \"$rev\" \"$dir\" |\n> -\t\t\tgit commit-tree \"$tree\" $headp -p \"$rev\") || exit $?\n> +\t\t\tgit commit-tree $arg_gpgsign \"$tree\" \\\n> +\t\t\t$headp -p \"$rev\") || exit $?\n> \telse\n> \t\trevp=$(peel_committish \"$rev\") || exit $?\n> \t\tcommit=$(add_msg \"$dir\" $headrev \"$rev\" |\n> -\t\t\tgit commit-tree \"$tree\" $headp -p \"$revp\") || exit $?\n> +\t\t\tgit commit-tree $arg_gpgsign \"$tree\" \\\n> +\t\t\t$headp -p \"$revp\") || exit $?\n> \tfi\n> \tgit reset \"$commit\" || exit $?\n> \n> diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt\n> index 004abf415b8..fa54541b288 100644\n> --- a/contrib/subtree/git-subtree.txt\n> +++ b/contrib/subtree/git-subtree.txt\n> @@ -185,6 +185,15 @@ subproject.\n> --message=<message>::\n> \tSpecify <message> as the commit message for the merge commit.\n> \n> +-S[<keyid>]::\n> +--gpg-sign[=<keyid>]::\n> +--no-gpg-sign::\n> +\tGPG-sign commits. The `keyid` argument is optional and\n> +\tdefaults to the committer identity; if specified, it must be\n> +\tstuck to the option without a space. `--no-gpg-sign` is useful to\n> +\tcountermand both `commit.gpgSign` configuration variable, and\n> +\tearlier `--gpg-sign`.\n> +\n> OPTIONS FOR 'split' (ALSO: 'push')\n> ----------------------------------\n> These options for 'split' may also be given to 'push' (which wraps\n> -- \n> gitgitgadget\n> \n\n"}]}