{"thread":{"id":"35267","subject":"Adding --gpg-sign to cherry-pick, revert, am, rebase","startedAt":"2013-11-03T15:54:16Z","lastAt":"2013-12-08T20:40:09Z","messageCount":15,"participants":["Nicolas Vigier","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"230053","messageId":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":null,"subject":"Adding --gpg-sign to cherry-pick, revert, am, rebase","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:16Z","receivedAt":"2013-11-03T15:54:16Z","isPatch":false,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Hello,\n\nHere is a series of patches to add the --gpg-sign option to be able to\ngpg sign commits, to the cherry-pick, revert, am and rebase commands.\n\nNicolas\n"},{"id":"230060","messageId":"1383494064-5653-2-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 1/8] cherry-pick, revert: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:17Z","receivedAt":"2013-11-03T15:54:17Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n Documentation/git-cherry-pick.txt | 7 ++++++-\n Documentation/git-revert.txt      | 6 +++++-\n builtin/revert.c                  | 2 ++\n sequencer.c                       | 7 +++++++\n sequencer.h                       | 2 ++\n 5 files changed, 22 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex c205d2363e42..f1e6b2fd6d15 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...\n+'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]\n+\t\t  [-S[<keyid>]] <commit>...\n 'git cherry-pick' --continue\n 'git cherry-pick' --quit\n 'git cherry-pick' --abort\n@@ -100,6 +101,10 @@ effect to your index in a row.\n --signoff::\n \tAdd Signed-off-by line at the end of the commit message.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n --ff::\n \tIf the current HEAD is the same as the parent of the\n \tcherry-pick'ed commit, then a fast forward to this commit will\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 2de67a54962b..9eb83f01a451 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -8,7 +8,7 @@ git-revert - Revert some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...\n+'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\n 'git revert' --continue\n 'git revert' --quit\n 'git revert' --abort\n@@ -80,6 +80,10 @@ more details.\n This is useful when reverting more than one commits'\n effect to your index in a row.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n -s::\n --signoff::\n \tAdd Signed-off-by line at the end of the commit message.\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 87659c9fdb74..065d88dd05ea 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\tOPT_STRING(0, \"strategy\", &opts->strategy, N_(\"strategy\"), N_(\"merge strategy\")),\n \t\tOPT_CALLBACK('X', \"strategy-option\", &opts, N_(\"option\"),\n \t\t\tN_(\"option for merge strategy\"), option_parse_x),\n+\t\t{ OPTION_STRING, 'S', \"gpg-sign\", &opts->gpg_sign, N_(\"key id\"),\n+\t\t  N_(\"GPG sign commit\"), PARSE_OPT_OPTARG, NULL, (intptr_t) \"\" },\n \t\tOPT_END(),\n \t\tOPT_END(),\n \t\tOPT_END(),\ndiff --git a/sequencer.c b/sequencer.c\nindex 06e52b4c83ff..b10a90fe70f6 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,\n {\n \tstruct argv_array array;\n \tint rc;\n+\tchar *gpg_sign;\n \n \targv_array_init(&array);\n \targv_array_push(&array, \"commit\");\n \targv_array_push(&array, \"-n\");\n \n+\tif (opts->gpg_sign) {\n+\t\tgpg_sign = xmalloc(3 + strlen(opts->gpg_sign));\n+\t\tsprintf(gpg_sign, \"-S%s\", opts->gpg_sign);\n+\t\targv_array_push(&array, gpg_sign);\n+\t\tfree(gpg_sign);\n+\t}\n \tif (opts->signoff)\n \t\targv_array_push(&array, \"-s\");\n \tif (!opts->edit) {\ndiff --git a/sequencer.h b/sequencer.h\nindex 1fc22dcabe13..db43e9cf86dc 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -37,6 +37,8 @@ struct replay_opts {\n \n \tint mainline;\n \n+\tconst char *gpg_sign;\n+\n \t/* Merge strategy */\n \tconst char *strategy;\n \tconst char **xopts;\n-- \n1.8.4.2\n"},{"id":"230057","messageId":"1383494064-5653-3-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 2/8] git-sh-setup.sh: add variable to use the stuck-long mode","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:18Z","receivedAt":"2013-11-03T15:54:18Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"If the variable $OPTIONS_STUCKLONG is not empty, then rev-parse\noption parsing is done in --stuck-long mode.\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n contrib/examples/git-checkout.sh | 1 +\n contrib/examples/git-clean.sh    | 1 +\n contrib/examples/git-clone.sh    | 1 +\n contrib/examples/git-merge.sh    | 1 +\n contrib/examples/git-repack.sh   | 1 +\n contrib/git-resurrect.sh         | 1 +\n git-am.sh                        | 1 +\n git-instaweb.sh                  | 1 +\n git-quiltimport.sh               | 1 +\n git-rebase.sh                    | 1 +\n git-request-pull.sh              | 1 +\n git-sh-setup.sh                  | 2 ++\n 12 files changed, 13 insertions(+)\n\ndiff --git a/contrib/examples/git-checkout.sh b/contrib/examples/git-checkout.sh\nindex 1a7689a48f07..d7507edaf564 100755\n--- a/contrib/examples/git-checkout.sh\n+++ b/contrib/examples/git-checkout.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n \n OPTIONS_KEEPDASHDASH=t\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git-checkout [options] [<branch>] [<paths>...]\n --\ndiff --git a/contrib/examples/git-clean.sh b/contrib/examples/git-clean.sh\nindex 01c95e9fe8a1..9d881cd90dfb 100755\n--- a/contrib/examples/git-clean.sh\n+++ b/contrib/examples/git-clean.sh\n@@ -4,6 +4,7 @@\n #\n \n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git-clean [options] <paths>...\n \ndiff --git a/contrib/examples/git-clone.sh b/contrib/examples/git-clone.sh\nindex 547228e13ce6..ea4757db33ab 100755\n--- a/contrib/examples/git-clone.sh\n+++ b/contrib/examples/git-clone.sh\n@@ -8,6 +8,7 @@\n # See git-sh-setup why.\n unset CDPATH\n \n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git-clone [options] [--] <repo> [<dir>]\n --\ndiff --git a/contrib/examples/git-merge.sh b/contrib/examples/git-merge.sh\nindex a5e42a9f0124..f0243d560121 100755\n--- a/contrib/examples/git-merge.sh\n+++ b/contrib/examples/git-merge.sh\n@@ -4,6 +4,7 @@\n #\n \n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git merge [options] <remote>...\n git merge [options] <msg> HEAD <remote>\ndiff --git a/contrib/examples/git-repack.sh b/contrib/examples/git-repack.sh\nindex 757933174e4c..fd5ced527da5 100755\n--- a/contrib/examples/git-repack.sh\n+++ b/contrib/examples/git-repack.sh\n@@ -4,6 +4,7 @@\n #\n \n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git repack [options]\n --\ndiff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\nindex a4ed4c3c62f0..d7e97bbc76c2 100755\n--- a/contrib/git-resurrect.sh\n+++ b/contrib/git-resurrect.sh\n@@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic\n branches.\"\n \n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git resurrect $USAGE\n --\ndiff --git a/git-am.sh b/git-am.sh\nindex bbea43075be0..a3b6f988229c 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -4,6 +4,7 @@\n \n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git am [options] [(<mbox>|<Maildir>)...]\n git am [options] (--continue | --skip | --abort)\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex e93a23867543..4aa3eb80fd25 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -5,6 +5,7 @@\n \n PERL='@@PERL@@'\n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git instaweb [options] (--start | --stop | --restart)\n --\ndiff --git a/git-quiltimport.sh b/git-quiltimport.sh\nindex 8e17525dd86a..167d79fea809 100755\n--- a/git-quiltimport.sh\n+++ b/git-quiltimport.sh\n@@ -1,5 +1,6 @@\n #!/bin/sh\n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git quiltimport [options]\n --\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 226752fbff62..6ebef7e8b86e 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -5,6 +5,7 @@\n \n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC=\"\\\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]\ndiff --git a/git-request-pull.sh b/git-request-pull.sh\nindex fe21d5db631c..cf4f1505a54b 100755\n--- a/git-request-pull.sh\n+++ b/git-request-pull.sh\n@@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output,\n and includes the given URL in the generated summary.'\n SUBDIRECTORY_OK='Yes'\n OPTIONS_KEEPDASHDASH=\n+OPTIONS_STUCKLONG=\n OPTIONS_SPEC='git request-pull [options] start url [end]\n --\n p    show patch text as well\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex ebfe8f7a4d06..e1d66799693d 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -75,6 +75,8 @@ if test -n \"$OPTIONS_SPEC\"; then\n \tparseopt_extra=\n \t[ -n \"$OPTIONS_KEEPDASHDASH\" ] &&\n \t\tparseopt_extra=\"--keep-dashdash\"\n+\t[ -n \"$OPTIONS_STUCKLONG\" ] &&\n+\t\tparseopt_extra=\"$parseopt_extra --stuck-long\"\n \n \teval \"$(\n \t\techo \"$OPTIONS_SPEC\" |\n-- \n1.8.4.2\n"},{"id":"230059","messageId":"1383494064-5653-4-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 3/8] am: parse options in stuck-long mode","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:19Z","receivedAt":"2013-11-03T15:54:19Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"There is no functionnal change. The reason for this change is to be able\nto add a new option taking an optional argument.\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n git-am.sh | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex a3b6f988229c..020abf6940bd 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -4,7 +4,7 @@\n \n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n-OPTIONS_STUCKLONG=\n+OPTIONS_STUCKLONG=t\n OPTIONS_SPEC=\"\\\n git am [options] [(<mbox>|<Maildir>)...]\n git am [options] (--continue | --skip | --abort)\n@@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore.\"\n \t\tabort=t ;;\n \t--rebasing)\n \t\trebasing=t threeway=t ;;\n-\t--resolvemsg)\n-\t\tshift; resolvemsg=$1 ;;\n-\t--whitespace|--directory|--exclude|--include)\n-\t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1=$2\")\"; shift ;;\n-\t-C|-p)\n-\t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1$2\")\"; shift ;;\n-\t--patch-format)\n-\t\tshift ; patch_format=\"$1\" ;;\n+\t--resolvemsg=*)\n+\t\tresolvemsg=\"${1#--resolvemsg=}\" ;;\n+\t--whitespace=*|--directory=*|--exclude=*|--include=*)\n+\t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1\")\" ;;\n+\t-C*|-p*)\n+\t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1\")\" ;;\n+\t--patch-format=*)\n+\t\tpatch_format=\"${1#--patch-format=}\" ;;\n \t--reject|--ignore-whitespace|--ignore-space-change)\n \t\tgit_apply_opt=\"$git_apply_opt $1\" ;;\n \t--committer-date-is-author-date)\n-- \n1.8.4.2\n"},{"id":"230058","messageId":"1383494064-5653-5-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 4/8] am: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:20Z","receivedAt":"2013-11-03T15:54:20Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n Documentation/git-am.txt | 6 +++++-\n git-am.sh                | 9 ++++++++-\n 2 files changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 54d8461d61b2..17924d0f3ff3 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -14,7 +14,7 @@ SYNOPSIS\n \t [--ignore-date] [--ignore-space-change | --ignore-whitespace]\n \t [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]\n \t [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]\n-\t [--[no-]scissors]\n+\t [--[no-]scissors] [-S[<keyid>]]\n \t [(<mbox> | <Maildir>)...]\n 'git am' (--continue | --skip | --abort)\n \n@@ -119,6 +119,10 @@ default.   You can use `--no-utf8` to override this.\n \tSkip the current patch.  This is only meaningful when\n \trestarting an aborted patch.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n --continue::\n -r::\n --resolved::\ndiff --git a/git-am.sh b/git-am.sh\nindex 020abf6940bd..dccbae2af0de 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -38,6 +38,7 @@ abort           restore the original branch and abort the patching operation.\n committer-date-is-author-date    lie about committer date\n ignore-date     use current timestamp for author date\n rerere-autoupdate update the index with reused conflict resolution if possible\n+S,gpg-sign?     GPG-sign commits\n rebasing*       (internal use for git-rebase)\"\n \n . git-sh-setup\n@@ -375,6 +376,7 @@ git_apply_opt=\n committer_date_is_author_date=\n ignore_date=\n allow_rerere_autoupdate=\n+gpg_sign_opt=\n \n if test \"$(git config --bool --get am.keepcr)\" = true\n then\n@@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore.\"\n \t\tkeepcr=t ;;\n \t--no-keep-cr)\n \t\tkeepcr=f ;;\n+\t--gpg-sign)\n+\t\tgpg_sign_opt=-S ;;\n+\t--gpg-sign=*)\n+\t\tgpg_sign_opt=\"-S${1#--gpg-sign=}\" ;;\n \t--)\n \t\tshift; break ;;\n \t*)\n@@ -900,7 +906,8 @@ did you forget to use 'git add'?\"\n \t\t\tGIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"\n \t\t\texport GIT_COMMITTER_DATE\n \t\tfi &&\n-\t\tgit commit-tree $tree ${parent:+-p} $parent <\"$dotest/final-commit\"\n+\t\tgit commit-tree ${gpg_sign_opt:+\"$gpg_sign_opt\"} $tree ${parent:+-p} $parent \\\n+\t\t\t<\"$dotest/final-commit\"\n \t) &&\n \tgit update-ref -m \"$GIT_REFLOG_ACTION: $FIRSTLINE\" HEAD $commit $parent ||\n \tstop_here $this\n-- \n1.8.4.2\n"},{"id":"230054","messageId":"1383494064-5653-6-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 5/8] rebase: remove useless arguments check","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:21Z","receivedAt":"2013-11-03T15:54:21Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Remove a check on the number of arguments for --onto and -x options.\nIt is not possible for $# to be <= 2 at this point :\n\n - if --onto or -x has an argument, git rev-parse --parseopt will\n   provide something like this :\n     set -- --onto 'x' --\n   when parsing the \"--onto\" option, $# will be 3 or more if there are\n   other options.\n\n - if --onto or -x doesn't have an argument, git rev-parse --parseopt\n   will exit with an error and display usage information.\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n git-rebase.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 6ebef7e8b86e..6b9279a69028 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -236,12 +236,10 @@ do\n \t\taction=${1##--}\n \t\t;;\n \t--onto)\n-\t\ttest 2 -le \"$#\" || usage\n \t\tonto=\"$2\"\n \t\tshift\n \t\t;;\n \t-x)\n-\t\ttest 2 -le \"$#\" || usage\n \t\tcmd=\"${cmd}exec $2${LF}\"\n \t\tshift\n \t\t;;\n-- \n1.8.4.2\n"},{"id":"230056","messageId":"1383494064-5653-7-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 6/8] rebase: don't try to match -M option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:22Z","receivedAt":"2013-11-03T15:54:22Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"The -M option does not exist in OPTIONS_SPEC, so there is no use to try\nto find it.\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 6b9279a69028..2f2f8ded5c3f 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -259,7 +259,7 @@ do\n \t--no-autosquash)\n \t\tautosquash=\n \t\t;;\n-\t-M|-m)\n+\t-m)\n \t\tdo_merge=t\n \t\t;;\n \t-X)\n-- \n1.8.4.2\n"},{"id":"230055","messageId":"1383494064-5653-8-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 7/8] rebase: parse options in stuck-long mode","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:23Z","receivedAt":"2013-11-03T15:54:23Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"There is no functionnal change. The reason for this change is to be able\nto add a new option taking an optional argument.\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n git-rebase.sh | 50 ++++++++++++++++++++++----------------------------\n 1 file changed, 22 insertions(+), 28 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 2f2f8ded5c3f..a6c294b2289b 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -5,7 +5,7 @@\n \n SUBDIRECTORY_OK=Yes\n OPTIONS_KEEPDASHDASH=\n-OPTIONS_STUCKLONG=\n+OPTIONS_STUCKLONG=t\n OPTIONS_SPEC=\"\\\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]\n git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]\n@@ -235,21 +235,19 @@ do\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n-\t--onto)\n-\t\tonto=\"$2\"\n-\t\tshift\n+\t--onto=*)\n+\t\tonto=\"${1#--onto=}\"\n \t\t;;\n-\t-x)\n-\t\tcmd=\"${cmd}exec $2${LF}\"\n-\t\tshift\n+\t--exec=*)\n+\t\tcmd=\"${cmd}exec ${1#--exec=}${LF}\"\n \t\t;;\n-\t-i)\n+\t--interactive)\n \t\tinteractive_rebase=explicit\n \t\t;;\n-\t-k)\n+\t--keep-empty)\n \t\tkeep_empty=yes\n \t\t;;\n-\t-p)\n+\t--preserve-merges)\n \t\tpreserve_merges=t\n \t\ttest -z \"$interactive_rebase\" && interactive_rebase=implied\n \t\t;;\n@@ -259,21 +257,19 @@ do\n \t--no-autosquash)\n \t\tautosquash=\n \t\t;;\n-\t-m)\n+\t--merge)\n \t\tdo_merge=t\n \t\t;;\n-\t-X)\n-\t\tshift\n-\t\tstrategy_opts=\"$strategy_opts $(git rev-parse --sq-quote \"--$1\")\"\n+\t--strategy-option=*)\n+\t\tstrategy_opts=\"$strategy_opts $(git rev-parse --sq-quote \"--${1#--strategy-option=}\")\"\n \t\tdo_merge=t\n \t\ttest -z \"$strategy\" && strategy=recursive\n \t\t;;\n-\t-s)\n-\t\tshift\n-\t\tstrategy=\"$1\"\n+\t--strategy=*)\n+\t\tstrategy=\"${1#--strategy=}\"\n \t\tdo_merge=t\n \t\t;;\n-\t-n)\n+\t--no-stat)\n \t\tdiffstat=\n \t\t;;\n \t--stat)\n@@ -282,21 +278,20 @@ do\n \t--autostash)\n \t\tautostash=true\n \t\t;;\n-\t-v)\n+\t--verbose)\n \t\tverbose=t\n \t\tdiffstat=t\n \t\tGIT_QUIET=\n \t\t;;\n-\t-q)\n+\t--quiet)\n \t\tGIT_QUIET=t\n \t\tgit_am_opt=\"$git_am_opt -q\"\n \t\tverbose=\n \t\tdiffstat=\n \t\t;;\n-\t--whitespace)\n-\t\tshift\n-\t\tgit_am_opt=\"$git_am_opt --whitespace=$1\"\n-\t\tcase \"$1\" in\n+\t--whitespace=*)\n+\t\tgit_am_opt=\"$git_am_opt --whitespace=${1#--whitespace=}\"\n+\t\tcase \"${1#--whitespace=}\" in\n \t\tfix|strip)\n \t\t\tforce_rebase=t\n \t\t\t;;\n@@ -309,14 +304,13 @@ do\n \t\tgit_am_opt=\"$git_am_opt $1\"\n \t\tforce_rebase=t\n \t\t;;\n-\t-C)\n-\t\tshift\n-\t\tgit_am_opt=\"$git_am_opt -C$1\"\n+\t-C*)\n+\t\tgit_am_opt=\"$git_am_opt $1\"\n \t\t;;\n \t--root)\n \t\trebase_root=t\n \t\t;;\n-\t-f|--no-ff)\n+\t--force-rebase|--no-ff)\n \t\tforce_rebase=t\n \t\t;;\n \t--rerere-autoupdate|--no-rerere-autoupdate)\n-- \n1.8.4.2\n"},{"id":"230061","messageId":"1383494064-5653-9-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"[PATCH 8/8] rebase: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T15:54:24Z","receivedAt":"2013-11-03T15:54:24Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\n Documentation/git-rebase.txt |  4 ++++\n git-rebase--am.sh            |  8 +++++---\n git-rebase--interactive.sh   | 32 ++++++++++++++++++++------------\n git-rebase--merge.sh         |  2 +-\n git-rebase.sh                | 11 +++++++++++\n 5 files changed, 41 insertions(+), 16 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 94e07fdab550..ed25bc3e41d1 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -281,6 +281,10 @@ which makes little sense.\n \tspecified, `-s recursive`.  Note the reversal of 'ours' and\n \t'theirs' as noted above for the `-m` option.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n -q::\n --quiet::\n \tBe quiet. Implies --no-stat.\ndiff --git a/git-rebase--am.sh b/git-rebase--am.sh\nindex 34e3102fcbfa..82ed63dd7874 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -5,7 +5,8 @@\n \n case \"$action\" in\n continue)\n-\tgit am --resolved --resolvemsg=\"$resolvemsg\" &&\n+\tgit am --resolved --resolvemsg=\"$resolvemsg\" \\\n+\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} &&\n \tmove_to_original_branch\n \treturn\n \t;;\n@@ -25,7 +26,7 @@ then\n \t# empty commits and even if it didn't the format doesn't really lend\n \t# itself well to recording empty patches.  fortunately, cherry-pick\n \t# makes this easy\n-\tgit cherry-pick --allow-empty \"$revisions\"\n+\tgit cherry-pick ${gpg_sign_opt:+\"$gpg_sign_opt\"} --allow-empty \"$revisions\"\n \tret=$?\n else\n \trm -f \"$GIT_DIR/rebased-patches\"\n@@ -59,7 +60,8 @@ else\n \t\treturn $?\n \tfi\n \n-\tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" <\"$GIT_DIR/rebased-patches\"\n+\tgit am $git_am_opt --rebasing --resolvemsg=\"$resolvemsg\" \\\n+\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} <\"$GIT_DIR/rebased-patches\"\n \tret=$?\n \n \trm -f \"$GIT_DIR/rebased-patches\"\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 3c6bed9a28f7..8aac6a85b192 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -184,7 +184,7 @@ exit_with_patch () {\n \tgit rev-parse --verify HEAD > \"$amend\"\n \twarn \"You can amend the commit now, with\"\n \twarn\n-\twarn \"\tgit commit --amend\"\n+\twarn \"\tgit commit --amend $gpg_sign_opt\"\n \twarn\n \twarn \"Once you are satisfied with your changes, run\"\n \twarn\n@@ -251,7 +251,8 @@ pick_one () {\n \n \ttest -d \"$rewritten\" &&\n \t\tpick_one_preserving_merges \"$@\" && return\n-\toutput eval git cherry-pick \"$strategy_args\" $empty_args $ff \"$@\"\n+\toutput eval git cherry-pick ${gpg_sign_opt:+\"$gpg_sign_opt\"} \\\n+\t\t\t\"$strategy_args\" $empty_args $ff \"$@\"\n }\n \n pick_one_preserving_merges () {\n@@ -362,7 +363,8 @@ pick_one_preserving_merges () {\n \t\t\techo \"$sha1 $(git rev-parse HEAD^0)\" >> \"$rewritten_list\"\n \t\t\t;;\n \t\t*)\n-\t\t\toutput eval git cherry-pick \"$strategy_args\" \"$@\" ||\n+\t\t\toutput eval git cherry-pick ${gpg_sign_opt:+\"$gpg_sign_opt\"} \\\n+\t\t\t\t\"$strategy_args\" \"$@\" ||\n \t\t\t\tdie_with_patch $sha1 \"Could not pick $sha1\"\n \t\t\t;;\n \t\tesac\n@@ -473,7 +475,8 @@ do_pick () {\n \t\t\t   --no-post-rewrite -n -q -C $1 &&\n \t\t\tpick_one -n $1 &&\n \t\t\tgit commit --allow-empty --allow-empty-message \\\n-\t\t\t\t   --amend --no-post-rewrite -n -q -C $1 ||\n+\t\t\t\t   --amend --no-post-rewrite -n -q -C $1 \\\n+\t\t\t\t   ${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\tdie_with_patch $1 \"Could not apply $1... $2\"\n \telse\n \t\tpick_one $1 ||\n@@ -500,7 +503,7 @@ do_next () {\n \n \t\tmark_action_done\n \t\tdo_pick $sha1 \"$rest\"\n-\t\tgit commit --amend --no-post-rewrite || {\n+\t\tgit commit --amend --no-post-rewrite ${gpg_sign_opt:+\"$gpg_sign_opt\"} || {\n \t\t\twarn \"Could not amend commit after successfully picking $sha1... $rest\"\n \t\t\twarn \"This is most likely due to an empty commit message, or the pre-commit hook\"\n \t\t\twarn \"failed. If the pre-commit hook failed, you may need to resolve the issue before\"\n@@ -545,19 +548,22 @@ do_next () {\n \t\tsquash|s|fixup|f)\n \t\t\t# This is an intermediate commit; its message will only be\n \t\t\t# used in case of trouble.  So use the long version:\n-\t\t\tdo_with_author output git commit --amend --no-verify -F \"$squash_msg\" ||\n+\t\t\tdo_with_author output git commit --amend --no-verify -F \"$squash_msg\" \\\n+\t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\t\tdie_failed_squash $sha1 \"$rest\"\n \t\t\t;;\n \t\t*)\n \t\t\t# This is the final command of this squash/fixup group\n \t\t\tif test -f \"$fixup_msg\"\n \t\t\tthen\n-\t\t\t\tdo_with_author git commit --amend --no-verify -F \"$fixup_msg\" ||\n+\t\t\t\tdo_with_author git commit --amend --no-verify -F \"$fixup_msg\" \\\n+\t\t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\t\t\tdie_failed_squash $sha1 \"$rest\"\n \t\t\telse\n \t\t\t\tcp \"$squash_msg\" \"$GIT_DIR\"/SQUASH_MSG || exit\n \t\t\t\trm -f \"$GIT_DIR\"/MERGE_MSG\n-\t\t\t\tdo_with_author git commit --amend --no-verify -F \"$GIT_DIR\"/SQUASH_MSG -e ||\n+\t\t\t\tdo_with_author git commit --amend --no-verify -F \"$GIT_DIR\"/SQUASH_MSG -e \\\n+\t\t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\t\t\tdie_failed_squash $sha1 \"$rest\"\n \t\t\tfi\n \t\t\trm -f \"$squash_msg\" \"$fixup_msg\"\n@@ -825,11 +831,11 @@ continue)\n \t\t\tdie \"You have staged changes in your working tree. If these changes are meant to be\n squashed into the previous commit, run:\n \n-  git commit --amend\n+  git commit --amend $gpg_sign_opt\n \n If they are meant to go into a new commit, run:\n \n-  git commit\n+  git commit $gpg_sign_opt\n \n In both case, once you're done, continue with:\n \n@@ -845,10 +851,12 @@ In both case, once you're done, continue with:\n \t\t\tdie \"\\\n You have uncommitted changes in your working tree. Please, commit them\n first and then run 'git rebase --continue' again.\"\n-\t\t\tdo_with_author git commit --amend --no-verify -F \"$msg\" -e ||\n+\t\t\tdo_with_author git commit --amend --no-verify -F \"$msg\" -e \\\n+\t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\t\tdie \"Could not commit staged changes.\"\n \t\telse\n-\t\t\tdo_with_author git commit --no-verify -F \"$msg\" -e ||\n+\t\t\tdo_with_author git commit --no-verify -F \"$msg\" -e \\\n+\t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n \t\t\t\tdie \"Could not commit staged changes.\"\n \t\tfi\n \tfi\ndiff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\nindex 16d18176ece5..1e747424c22e 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -25,7 +25,7 @@ continue_merge () {\n \tcmt=`cat \"$state_dir/current\"`\n \tif ! git diff-index --quiet --ignore-submodules HEAD --\n \tthen\n-\t\tif ! git commit --no-verify -C \"$cmt\"\n+\t\tif ! git commit ${gpg_sign_opt:+\"$gpg_sign_opt\"} --no-verify -C \"$cmt\"\n \t\tthen\n \t\t\techo \"Commit failed, please do not call \\\"git commit\\\"\"\n \t\t\techo \"directly, but instead do one of the following: \"\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex a6c294b2289b..a2c0ea3cf4ba 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -36,6 +36,7 @@ ignore-date!       passed to 'git am'\n whitespace=!       passed to 'git apply'\n ignore-whitespace! passed to 'git apply'\n C=!                passed to 'git apply'\n+S,gpg-sign?        GPG-sign commits\n  Actions:\n continue!          continue\n abort!             abort and check out the original branch\n@@ -83,6 +84,7 @@ preserve_merges=\n autosquash=\n keep_empty=\n test \"$(git config --bool rebase.autosquash)\" = \"true\" && autosquash=t\n+gpg_sign_opt=\n \n read_basic_state () {\n \ttest -f \"$state_dir/head-name\" &&\n@@ -105,6 +107,8 @@ read_basic_state () {\n \t\tstrategy_opts=\"$(cat \"$state_dir\"/strategy_opts)\"\n \ttest -f \"$state_dir\"/allow_rerere_autoupdate &&\n \t\tallow_rerere_autoupdate=\"$(cat \"$state_dir\"/allow_rerere_autoupdate)\"\n+\ttest -f \"$state_dir\"/gpg_sign_opt &&\n+\t\tgpg_sign_opt=\"$(cat \"$state_dir\"/gpg_sign_opt)\"\n }\n \n write_basic_state () {\n@@ -118,6 +122,7 @@ write_basic_state () {\n \t\t\"$state_dir\"/strategy_opts\n \ttest -n \"$allow_rerere_autoupdate\" && echo \"$allow_rerere_autoupdate\" > \\\n \t\t\"$state_dir\"/allow_rerere_autoupdate\n+\ttest -n \"$gpg_sign_opt\" && echo \"$gpg_sign_opt\" > \"$state_dir\"/gpg_sign_opt\n }\n \n output () {\n@@ -316,6 +321,12 @@ do\n \t--rerere-autoupdate|--no-rerere-autoupdate)\n \t\tallow_rerere_autoupdate=\"$1\"\n \t\t;;\n+\t--gpg-sign)\n+\t\tgpg_sign_opt=-S\n+\t\t;;\n+\t--gpg-sign=*)\n+\t\tgpg_sign_opt=\"-S${1#--gpg-sign=}\"\n+\t\t;;\n \t--)\n \t\tshift\n \t\tbreak\n-- \n1.8.4.2\n"},{"id":"230063","messageId":"20131103175015.GA183446@vauxhall.crustytoothpaste.net","threadId":"35267","inReplyTo":"1383494064-5653-2-git-send-email-boklm@mars-attacks.org","subject":"Re: [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-11-03T17:50:15Z","receivedAt":"2013-11-03T17:50:15Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, Nov 03, 2013 at 04:54:17PM +0100, Nicolas Vigier wrote:\n> diff --git a/sequencer.h b/sequencer.h\n> index 1fc22dcabe13..db43e9cf86dc 100644\n> --- a/sequencer.h\n> +++ b/sequencer.h\n> @@ -37,6 +37,8 @@ struct replay_opts {\n>  \n>  \tint mainline;\n>  \n> +\tconst char *gpg_sign;\n> +\n>  \t/* Merge strategy */\n>  \tconst char *strategy;\n>  \tconst char **xopts;\n\nOne thing you're missing here is the ability to save and retrieve the\noptions.  You might be cherry-picking or reverting multiple commits and\nget interrupted (maybe one is already applied) and need to use\n--continue.\n\nSo populate_options_cb and save_opts need to learn about this sequencer\noption so that after --continue, commits continue to get signed.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"230064","messageId":"20131103180059.GU4589@mars-attacks.org","threadId":"35267","inReplyTo":"20131103175015.GA183446@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T18:00:59Z","receivedAt":"2013-11-03T18:00:59Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"On Sun, 03 Nov 2013, brian m. carlson wrote:\n\n> On Sun, Nov 03, 2013 at 04:54:17PM +0100, Nicolas Vigier wrote:\n> > diff --git a/sequencer.h b/sequencer.h\n> > index 1fc22dcabe13..db43e9cf86dc 100644\n> > --- a/sequencer.h\n> > +++ b/sequencer.h\n> > @@ -37,6 +37,8 @@ struct replay_opts {\n> >  \n> >  \tint mainline;\n> >  \n> > +\tconst char *gpg_sign;\n> > +\n> >  \t/* Merge strategy */\n> >  \tconst char *strategy;\n> >  \tconst char **xopts;\n> \n> One thing you're missing here is the ability to save and retrieve the\n> options.  You might be cherry-picking or reverting multiple commits and\n> get interrupted (maybe one is already applied) and need to use\n> --continue.\n> \n> So populate_options_cb and save_opts need to learn about this sequencer\n> option so that after --continue, commits continue to get signed.\n\nAh indeed, I didn't think about that. I will look at it. Thanks.\n\n"},{"id":"230065","messageId":"1383504375-22743-1-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"20131103175015.GA183446@vauxhall.crustytoothpaste.net","subject":"[PATCH] cherry-pick, revert: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T18:46:15Z","receivedAt":"2013-11-03T18:46:15Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>\nHelped-by: Brian M. Carlson <sandals@crustytoothpaste.net>\n---\n Documentation/git-cherry-pick.txt |  7 ++++++-\n Documentation/git-revert.txt      |  6 +++++-\n builtin/revert.c                  |  2 ++\n sequencer.c                       | 11 +++++++++++\n sequencer.h                       |  2 ++\n 5 files changed, 26 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt\nindex c205d2363e42..f1e6b2fd6d15 100644\n--- a/Documentation/git-cherry-pick.txt\n+++ b/Documentation/git-cherry-pick.txt\n@@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...\n+'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]\n+\t\t  [-S[<keyid>]] <commit>...\n 'git cherry-pick' --continue\n 'git cherry-pick' --quit\n 'git cherry-pick' --abort\n@@ -100,6 +101,10 @@ effect to your index in a row.\n --signoff::\n \tAdd Signed-off-by line at the end of the commit message.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n --ff::\n \tIf the current HEAD is the same as the parent of the\n \tcherry-pick'ed commit, then a fast forward to this commit will\ndiff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt\nindex 2de67a54962b..9eb83f01a451 100644\n--- a/Documentation/git-revert.txt\n+++ b/Documentation/git-revert.txt\n@@ -8,7 +8,7 @@ git-revert - Revert some existing commits\n SYNOPSIS\n --------\n [verse]\n-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...\n+'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\n 'git revert' --continue\n 'git revert' --quit\n 'git revert' --abort\n@@ -80,6 +80,10 @@ more details.\n This is useful when reverting more than one commits'\n effect to your index in a row.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n -s::\n --signoff::\n \tAdd Signed-off-by line at the end of the commit message.\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 87659c9fdb74..065d88dd05ea 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)\n \t\tOPT_STRING(0, \"strategy\", &opts->strategy, N_(\"strategy\"), N_(\"merge strategy\")),\n \t\tOPT_CALLBACK('X', \"strategy-option\", &opts, N_(\"option\"),\n \t\t\tN_(\"option for merge strategy\"), option_parse_x),\n+\t\t{ OPTION_STRING, 'S', \"gpg-sign\", &opts->gpg_sign, N_(\"key id\"),\n+\t\t  N_(\"GPG sign commit\"), PARSE_OPT_OPTARG, NULL, (intptr_t) \"\" },\n \t\tOPT_END(),\n \t\tOPT_END(),\n \t\tOPT_END(),\ndiff --git a/sequencer.c b/sequencer.c\nindex 06e52b4c83ff..2048cd81b3b2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,\n {\n \tstruct argv_array array;\n \tint rc;\n+\tchar *gpg_sign;\n \n \targv_array_init(&array);\n \targv_array_push(&array, \"commit\");\n \targv_array_push(&array, \"-n\");\n \n+\tif (opts->gpg_sign) {\n+\t\tgpg_sign = xmalloc(3 + strlen(opts->gpg_sign));\n+\t\tsprintf(gpg_sign, \"-S%s\", opts->gpg_sign);\n+\t\targv_array_push(&array, gpg_sign);\n+\t\tfree(gpg_sign);\n+\t}\n \tif (opts->signoff)\n \t\targv_array_push(&array, \"-s\");\n \tif (!opts->edit) {\n@@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data)\n \t\topts->mainline = git_config_int(key, value);\n \telse if (!strcmp(key, \"options.strategy\"))\n \t\tgit_config_string(&opts->strategy, key, value);\n+\telse if (!strcmp(key, \"options.gpg-sign\"))\n+\t\tgit_config_string(&opts->gpg_sign, key, value);\n \telse if (!strcmp(key, \"options.strategy-option\")) {\n \t\tALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);\n \t\topts->xopts[opts->xopts_nr++] = xstrdup(value);\n@@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts)\n \t}\n \tif (opts->strategy)\n \t\tgit_config_set_in_file(opts_file, \"options.strategy\", opts->strategy);\n+\tif (opts->gpg_sign)\n+\t\tgit_config_set_in_file(opts_file, \"options.gpg-sign\", opts->gpg_sign);\n \tif (opts->xopts) {\n \t\tint i;\n \t\tfor (i = 0; i < opts->xopts_nr; i++)\ndiff --git a/sequencer.h b/sequencer.h\nindex 1fc22dcabe13..db43e9cf86dc 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -37,6 +37,8 @@ struct replay_opts {\n \n \tint mainline;\n \n+\tconst char *gpg_sign;\n+\n \t/* Merge strategy */\n \tconst char *strategy;\n \tconst char **xopts;\n-- \n1.8.4.2\n"},{"id":"230066","messageId":"20131103184830.GB183446@vauxhall.crustytoothpaste.net","threadId":"35267","inReplyTo":"1383504375-22743-1-git-send-email-boklm@mars-attacks.org","subject":"Re: [PATCH] cherry-pick, revert: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-11-03T18:48:30Z","receivedAt":"2013-11-03T18:48:30Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, Nov 03, 2013 at 07:46:15PM +0100, Nicolas Vigier wrote:\n> diff --git a/sequencer.c b/sequencer.c\n> index 06e52b4c83ff..2048cd81b3b2 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,\n>  {\n>  \tstruct argv_array array;\n>  \tint rc;\n> +\tchar *gpg_sign;\n>  \n>  \targv_array_init(&array);\n>  \targv_array_push(&array, \"commit\");\n>  \targv_array_push(&array, \"-n\");\n>  \n> +\tif (opts->gpg_sign) {\n> +\t\tgpg_sign = xmalloc(3 + strlen(opts->gpg_sign));\n> +\t\tsprintf(gpg_sign, \"-S%s\", opts->gpg_sign);\n> +\t\targv_array_push(&array, gpg_sign);\n> +\t\tfree(gpg_sign);\n> +\t}\n>  \tif (opts->signoff)\n>  \t\targv_array_push(&array, \"-s\");\n>  \tif (!opts->edit) {\n> @@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data)\n>  \t\topts->mainline = git_config_int(key, value);\n>  \telse if (!strcmp(key, \"options.strategy\"))\n>  \t\tgit_config_string(&opts->strategy, key, value);\n> +\telse if (!strcmp(key, \"options.gpg-sign\"))\n> +\t\tgit_config_string(&opts->gpg_sign, key, value);\n>  \telse if (!strcmp(key, \"options.strategy-option\")) {\n>  \t\tALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);\n>  \t\topts->xopts[opts->xopts_nr++] = xstrdup(value);\n> @@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts)\n>  \t}\n>  \tif (opts->strategy)\n>  \t\tgit_config_set_in_file(opts_file, \"options.strategy\", opts->strategy);\n> +\tif (opts->gpg_sign)\n> +\t\tgit_config_set_in_file(opts_file, \"options.gpg-sign\", opts->gpg_sign);\n>  \tif (opts->xopts) {\n>  \t\tint i;\n>  \t\tfor (i = 0; i < opts->xopts_nr; i++)\n\nLooks much better.  That's essentially what I did when I was patching\nthat particular area.  Thanks for posting this patch set; it's something\nI've wanted for a while, but never got around to actually doing myself.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"230068","messageId":"1383507042-5599-1-git-send-email-boklm@mars-attacks.org","threadId":"35267","inReplyTo":"1383494064-5653-5-git-send-email-boklm@mars-attacks.org","subject":"[PATCH] am: add the --gpg-sign option","fromName":"Nicolas Vigier","fromEmail":"boklm@mars-attacks.org","sentAt":"2013-11-03T19:30:42Z","receivedAt":"2013-11-03T19:30:42Z","isPatch":true,"sender":{"key":"boklm@mars-attacks.org","avatar":"https://avatars.githubusercontent.com/u/405910?v=4"},"body":"Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>\n---\nSecond version of this patch. In the first version I forgot to save the\nstatus of the gpg-sign option so that it is also used with --continue.\n\n Documentation/git-am.txt |  6 +++++-\n git-am.sh                | 11 ++++++++++-\n 2 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 54d8461d61b2..17924d0f3ff3 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -14,7 +14,7 @@ SYNOPSIS\n \t [--ignore-date] [--ignore-space-change | --ignore-whitespace]\n \t [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]\n \t [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet]\n-\t [--[no-]scissors]\n+\t [--[no-]scissors] [-S[<keyid>]]\n \t [(<mbox> | <Maildir>)...]\n 'git am' (--continue | --skip | --abort)\n \n@@ -119,6 +119,10 @@ default.   You can use `--no-utf8` to override this.\n \tSkip the current patch.  This is only meaningful when\n \trestarting an aborted patch.\n \n+-S[<keyid>]::\n+--gpg-sign[=<keyid>]::\n+\tGPG-sign commits.\n+\n --continue::\n -r::\n --resolved::\ndiff --git a/git-am.sh b/git-am.sh\nindex 020abf6940bd..dd2f4611f246 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -38,6 +38,7 @@ abort           restore the original branch and abort the patching operation.\n committer-date-is-author-date    lie about committer date\n ignore-date     use current timestamp for author date\n rerere-autoupdate update the index with reused conflict resolution if possible\n+S,gpg-sign?     GPG-sign commits\n rebasing*       (internal use for git-rebase)\"\n \n . git-sh-setup\n@@ -375,6 +376,7 @@ git_apply_opt=\n committer_date_is_author_date=\n ignore_date=\n allow_rerere_autoupdate=\n+gpg_sign_opt=\n \n if test \"$(git config --bool --get am.keepcr)\" = true\n then\n@@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore.\"\n \t\tkeepcr=t ;;\n \t--no-keep-cr)\n \t\tkeepcr=f ;;\n+\t--gpg-sign)\n+\t\tgpg_sign_opt=-S ;;\n+\t--gpg-sign=*)\n+\t\tgpg_sign_opt=\"-S${1#--gpg-sign=}\" ;;\n \t--)\n \t\tshift; break ;;\n \t*)\n@@ -564,6 +570,7 @@ Use \\\"git am --abort\\\" to remove it.\")\"\n \techo \"$scissors\" >\"$dotest/scissors\"\n \techo \"$no_inbody_headers\" >\"$dotest/no_inbody_headers\"\n \techo \"$GIT_QUIET\" >\"$dotest/quiet\"\n+\techo \"$gpg_sign_opt\" >\"$dotest/gpg-sign-opt\"\n \techo 1 >\"$dotest/next\"\n \tif test -n \"$rebasing\"\n \tthen\n@@ -645,6 +652,7 @@ then\n else\n \tSIGNOFF=\n fi\n+gpg_sign_opt=$(cat \"$dotest/gpg-sign-opt\")\n \n last=`cat \"$dotest/last\"`\n this=`cat \"$dotest/next\"`\n@@ -900,7 +908,8 @@ did you forget to use 'git add'?\"\n \t\t\tGIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"\n \t\t\texport GIT_COMMITTER_DATE\n \t\tfi &&\n-\t\tgit commit-tree $tree ${parent:+-p} $parent <\"$dotest/final-commit\"\n+\t\tgit commit-tree ${gpg_sign_opt:+\"$gpg_sign_opt\"} $tree ${parent:+-p} $parent \\\n+\t\t\t<\"$dotest/final-commit\"\n \t) &&\n \tgit update-ref -m \"$GIT_REFLOG_ACTION: $FIRSTLINE\" HEAD $commit $parent ||\n \tstop_here $this\n-- \n1.8.4.2\n"},{"id":"231768","messageId":"20131208204009.GG118858@vauxhall.crustytoothpaste.net","threadId":"35267","inReplyTo":"1383494064-5653-1-git-send-email-boklm@mars-attacks.org","subject":"Re: Adding --gpg-sign to cherry-pick, revert, am, rebase","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2013-12-08T20:40:09Z","receivedAt":"2013-12-08T20:40:09Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, Nov 03, 2013 at 04:54:16PM +0100, Nicolas Vigier wrote:\n> Hello,\n> \n> Here is a series of patches to add the --gpg-sign option to be able to\n> gpg sign commits, to the cherry-pick, revert, am and rebase commands.\n\nWhatever happened to this series?  It looks like it never made it into\nnext, master, or pu, and Junio's immediately-following \"What's cooking\"\nemail didn't mention it.\n\nI'm really very interested in seeing it merged, so if there's something\nI can do to help it along, please let me know.\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"}]}