{"thread":{"id":"35778","subject":"[PATCH v3 2/9] git-sh-setup.sh: add variable to use the stuck-long mode","startedAt":"2014-02-01T02:17:57Z","lastAt":"2014-02-08T13:04:09Z","messageCount":15,"participants":["brian m. carlson","Junio C Hamano","Philip Oakley"],"isPatch":true,"patchVersion":3,"patchTotal":9},"messages":[{"id":"234007","messageId":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":null,"subject":"[PATCH v3 0/9] add --gpg-sign to rebase and pull","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:17:57Z","receivedAt":"2014-02-01T02:17:57Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"This series was posted to the list some time back.  This is a re-send of\nNicolas Vigier's work with an additional patch that adds --gpg-sign to\npull as well, as well as the fixes that Junio suggested in review.\n\nSince the parsed option value for --gpg-sign=<value> is used not only as\nan argument to other commands, but also as output to the user, I chose\nto abuse git rev-parse --sq-quote slightly to quote only the argument,\nwhich I feel is more aesthetically pleasing than quoting the entire\noption, and perhaps less confusing for the novice shell user.  Both\noptions are equally functional.\n\nOther than that, this is a simple reroll addressing Junio's review\ncomments.  I've been using it on my laptop for some time, and it works\nfine for me, although further comments are certainly welcome.\n\nNicolas Vigier (8):\n  cherry-pick, revert: add the --gpg-sign option\n  git-sh-setup.sh: add variable to use the stuck-long mode\n  am: parse options in stuck-long mode\n  am: add the --gpg-sign option\n  rebase: remove useless arguments check\n  rebase: don't try to match -M option\n  rebase: parse options in stuck-long mode\n  rebase: add the --gpg-sign option\n\nbrian m. carlson (1):\n  pull: add the --gpg-sign option.\n\n Documentation/git-am.txt          |  6 +++-\n Documentation/git-cherry-pick.txt |  7 ++++-\n Documentation/git-rebase.txt      |  4 +++\n Documentation/git-revert.txt      |  6 +++-\n builtin/revert.c                  |  2 ++\n contrib/git-resurrect.sh          |  1 +\n git-am.sh                         | 26 ++++++++++------\n git-instaweb.sh                   |  1 +\n git-pull.sh                       | 13 +++++++-\n git-quiltimport.sh                |  1 +\n git-rebase--am.sh                 |  8 +++--\n git-rebase--interactive.sh        | 32 +++++++++++--------\n git-rebase--merge.sh              |  2 +-\n git-rebase.sh                     | 65 ++++++++++++++++++++++-----------------\n git-request-pull.sh               |  1 +\n git-sh-setup.sh                   |  2 ++\n sequencer.c                       | 11 +++++++\n sequencer.h                       |  2 ++\n 18 files changed, 132 insertions(+), 58 deletions(-)\n\n-- \n1.9.rc1.1006.g13f506b.dirty\n"},{"id":"234011","messageId":"1391221086-1044384-2-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:17:58Z","receivedAt":"2014-02-01T02:17:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\nSigned-off-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 c205d23..f1e6b2f 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 2de67a5..9eb83f0 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 87659c9..065d88d 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 90cac7b..bde5f04 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 1fc22dc..db43e9c 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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234006","messageId":"1391221086-1044384-3-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 2/9] git-sh-setup.sh: add variable to use the stuck-long mode","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:17:59Z","receivedAt":"2014-02-01T02:17:59Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nIf 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>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\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 7 files changed, 8 insertions(+)\n\ndiff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh\nindex a4ed4c3..d7e97bb 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 bbea430..a3b6f98 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 e93a238..4aa3eb8 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 8e17525..167d79f 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 8a3efa2..c1f98ae 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 fe21d5d..cf4f150 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 fffa3c7..5f28b32 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -72,6 +72,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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234009","messageId":"1391221086-1044384-4-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 3/9] am: parse options in stuck-long mode","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:00Z","receivedAt":"2014-02-01T02:18:00Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nThere is no functional 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>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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 a3b6f98..020abf6 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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234008","messageId":"1391221086-1044384-5-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 4/9] am: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:01Z","receivedAt":"2014-02-01T02:18:01Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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 54d8461..17924d0 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 020abf6..78517f2 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 ${parent:+-p} $parent ${gpg_sign_opt:+\"$gpg_sign_opt\"} $tree  \\\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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234015","messageId":"1391221086-1044384-6-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 5/9] rebase: remove useless arguments check","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:02Z","receivedAt":"2014-02-01T02:18:02Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nRemove 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>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n git-rebase.sh | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex c1f98ae..d1835ba 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -238,12 +238,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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234014","messageId":"1391221086-1044384-7-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 6/9] rebase: don't try to match -M option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:03Z","receivedAt":"2014-02-01T02:18:03Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nThe -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>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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 d1835ba..3b55211 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -267,7 +267,7 @@ do\n \t--no-fork-point)\n \t\tfork_point=\n \t\t;;\n-\t-M|-m)\n+\t-m)\n \t\tdo_merge=t\n \t\t;;\n \t-X)\n-- \n1.9.rc1.1006.g13f506b.dirty\n"},{"id":"234010","messageId":"1391221086-1044384-8-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 7/9] rebase: parse options in stuck-long mode","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:04Z","receivedAt":"2014-02-01T02:18:04Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nThere 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>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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 3b55211..842d7d4 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@@ -237,21 +237,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@@ -267,21 +265,19 @@ do\n \t--no-fork-point)\n \t\tfork_point=\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@@ -290,21 +286,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@@ -317,14 +312,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.9.rc1.1006.g13f506b.dirty\n"},{"id":"234012","messageId":"1391221086-1044384-9-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 8/9] rebase: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:05Z","receivedAt":"2014-02-01T02:18:05Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"From: Nicolas Vigier <boklm@mars-attacks.org>\n\nSigned-off-by: Nicolas Vigier <boklm@mars-attacks.org>\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\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                | 14 ++++++++++++++\n 5 files changed, 44 insertions(+), 16 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex 2889be6..2a93c64 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 a4f683a..df46f4c 100644\n--- a/git-rebase--am.sh\n+++ b/git-rebase--am.sh\n@@ -6,7 +6,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@@ -26,7 +27,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@@ -60,7 +61,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 43c19e0..73d32dd 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -181,7 +181,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@@ -248,7 +248,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@@ -359,7 +360,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@@ -470,7 +472,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@@ -497,7 +500,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@@ -542,19 +545,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@@ -822,11 +828,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@@ -842,10 +848,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 e7d96de..5381857 100644\n--- a/git-rebase--merge.sh\n+++ b/git-rebase--merge.sh\n@@ -27,7 +27,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 842d7d4..055af1b 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -37,6 +37,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@@ -85,6 +86,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@@ -107,6 +109,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@@ -120,6 +124,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@@ -324,6 +329,15 @@ 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\t# Try to quote only the argument, as this will appear in human-readable\n+\t\t# output as well as being passed to commands.\n+\t\tgpg_sign_opt=\"-S$(git rev-parse --sq-quote \"${1#--gpg-sign=}\" |\n+\t\t\tsed 's/^ //')\"\n+\t\t;;\n \t--)\n \t\tshift\n \t\tbreak\n-- \n1.9.rc1.1006.g13f506b.dirty\n"},{"id":"234013","messageId":"1391221086-1044384-10-git-send-email-sandals@crustytoothpaste.net","threadId":"35778","inReplyTo":"1391221086-1044384-1-git-send-email-sandals@crustytoothpaste.net","subject":"[PATCH v3 9/9] pull: add the --gpg-sign option.","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-01T02:18:06Z","receivedAt":"2014-02-01T02:18:06Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"git merge already allows us to sign commits, and git rebase has recently\nlearned how to do so as well.  Teach git pull to parse the -S/--gpg-sign\noption and pass this along to merge or rebase, as appropriate.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n git-pull.sh | 13 ++++++++++++-\n 1 file changed, 12 insertions(+), 1 deletion(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 0a5aa2c..3b2ea9e 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -138,6 +138,15 @@ do\n \t--no-verify-signatures)\n \t\tverify_signatures=--no-verify-signatures\n \t\t;;\n+\t--gpg-sign|-S)\n+\t\tgpg_sign_args=-S\n+\t\t;;\n+\t--gpg-sign=*)\n+\t\tgpg_sign_args=\"$(git rev-parse --sq-quote \"-S${1#--gpg-sign=}\")\"\n+\t\t;;\n+\t-S*)\n+\t\tgpg_sign_args=\"-S${1#-S}\"\n+\t\t;;\n \t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n \t\tdry_run=--dry-run\n \t\t;;\n@@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg <\"$GIT_DIR/FETCH_HEAD\") || exit\n case \"$rebase\" in\n true)\n \teval=\"git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity\"\n+\teval=\"$eval $gpg_sign_args\"\n \teval=\"$eval --onto $merge_head ${oldremoteref:-$merge_head}\"\n \t;;\n *)\n \teval=\"git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only\"\n-\teval=\"$eval  $log_arg $strategy_args $merge_args $verbosity $progress\"\n+\teval=\"$eval $log_arg $strategy_args $merge_args $verbosity $progress\"\n+\teval=\"$eval $gpg_sign_args\"\n \teval=\"$eval \\\"\\$merge_name\\\" HEAD $merge_head\"\n \t;;\n esac\n-- \n1.9.rc1.1006.g13f506b.dirty\n"},{"id":"234151","messageId":"xmqqd2j4djkc.fsf@gitster.dls.corp.google.com","threadId":"35778","inReplyTo":"1391221086-1044384-10-git-send-email-sandals@crustytoothpaste.net","subject":"Re: [PATCH v3 9/9] pull: add the --gpg-sign option.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-03T20:31:47Z","receivedAt":"2014-02-03T20:31:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> git merge already allows us to sign commits, and git rebase has recently\n> learned how to do so as well.  Teach git pull to parse the -S/--gpg-sign\n> option and pass this along to merge or rebase, as appropriate.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n>  git-pull.sh | 13 ++++++++++++-\n>  1 file changed, 12 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 0a5aa2c..3b2ea9e 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -138,6 +138,15 @@ do\n>  \t--no-verify-signatures)\n>  \t\tverify_signatures=--no-verify-signatures\n>  \t\t;;\n> +\t--gpg-sign|-S)\n> +\t\tgpg_sign_args=-S\n> +\t\t;;\n> +\t--gpg-sign=*)\n> +\t\tgpg_sign_args=\"$(git rev-parse --sq-quote \"-S${1#--gpg-sign=}\")\"\n> +\t\t;;\n> +\t-S*)\n> +\t\tgpg_sign_args=\"-S${1#-S}\"\n> +\t\t;;\n\nInteresting.  Remove -S from the beginning and then prefix that with -S?\n\nAlso, --gpg-sign='\"b m c\" <s@c.n>' and -S'\"b m c\" <s@c.n>' from the\ncommand line of this program would result in $gpg_sign_args that are\ndifferently quoted.  Both of them cannot be correct at the same time.\n\n\n>  \t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n>  \t\tdry_run=--dry-run\n>  \t\t;;\n> @@ -305,11 +314,13 @@ merge_name=$(git fmt-merge-msg $log_arg <\"$GIT_DIR/FETCH_HEAD\") || exit\n>  case \"$rebase\" in\n>  true)\n>  \teval=\"git-rebase $diffstat $strategy_args $merge_args $rebase_args $verbosity\"\n> +\teval=\"$eval $gpg_sign_args\"\n>  \teval=\"$eval --onto $merge_head ${oldremoteref:-$merge_head}\"\n>  \t;;\n>  *)\n>  \teval=\"git-merge $diffstat $no_commit $verify_signatures $edit $squash $no_ff $ff_only\"\n> -\teval=\"$eval  $log_arg $strategy_args $merge_args $verbosity $progress\"\n> +\teval=\"$eval $log_arg $strategy_args $merge_args $verbosity $progress\"\n> +\teval=\"$eval $gpg_sign_args\"\n>  \teval=\"$eval \\\"\\$merge_name\\\" HEAD $merge_head\"\n>  \t;;\n>  esac\n"},{"id":"234152","messageId":"xmqq8utrex8w.fsf@gitster.dls.corp.google.com","threadId":"35778","inReplyTo":"1391221086-1044384-2-git-send-email-sandals@crustytoothpaste.net","subject":"Re: [PATCH v3 1/9] cherry-pick, revert: add the --gpg-sign option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-03T20:50:55Z","receivedAt":"2014-02-03T20:50:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> diff --git a/sequencer.c b/sequencer.c\n> index 90cac7b..bde5f04 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\nPerhaps\n\n\targv_array_pushf(&array, \"-S%s\", opts->gpg_sign);\n\nwithout any temporary?  That would save 5 lines in total.\n\n> +\t}\n>  \tif (opts->signoff)\n>  \t\targv_array_push(&array, \"-s\");\n>  \tif (!opts->edit) {\n\n\ndiff --git a/sequencer.c b/sequencer.c\nindex bde5f04..b200dce 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -392,18 +392,13 @@ 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->gpg_sign)\n+\t\targv_array_pushf(&array, \"-S%s\", opts->gpg_sign);\n \tif (opts->signoff)\n \t\targv_array_push(&array, \"-s\");\n \tif (!opts->edit) {\n"},{"id":"234155","messageId":"xmqqlhxrdgb5.fsf@gitster.dls.corp.google.com","threadId":"35778","inReplyTo":"1391221086-1044384-9-git-send-email-sandals@crustytoothpaste.net","subject":"Re: [PATCH v3 8/9] rebase: add the --gpg-sign option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-03T21:42:06Z","receivedAt":"2014-02-03T21:42:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\n> index 43c19e0..73d32dd 100644\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -181,7 +181,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> @@ -248,7 +248,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\nThis uses \"$gpg_sign_opt\" on \"eval\", which means that the variable's\ncontents must be properly shell quoted, e.g.\n\n\tgpg_sign_opt='-S'\\''\"brian m. carson\" <sandals@c.net>'\\'\n\nthroughout this script, so that everything between the first\ndouble-quote \" and closing ket > is passed as a single parameter\nwithout being broken up.\n\n> @@ -359,7 +360,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\nAnd this part has the same expectation.  However...\n\n> @@ -470,7 +472,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\nThis does not want that \"extra level\" of quoting.  It would want to\nhave something like this instead:\n\n\tgpg_sign_opt='-S\"brian m. carson\" <sandals@c.net>'\n\nI am not sure how you are managing these two conflicting needs of\nthe use sites.\n\n> @@ -497,7 +500,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\nDitto.\n\n> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh\n> index e7d96de..5381857 100644\n> --- a/git-rebase--merge.sh\n> +++ b/git-rebase--merge.sh\n> @@ -27,7 +27,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\nDitto.\n\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: \"\n> diff --git a/git-rebase.sh b/git-rebase.sh\n> index 842d7d4..055af1b 100755\n> --- a/git-rebase.sh\n> +++ b/git-rebase.sh\n> @@ -37,6 +37,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> @@ -85,6 +86,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> @@ -107,6 +109,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> @@ -120,6 +124,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> @@ -324,6 +329,15 @@ 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\t# Try to quote only the argument, as this will appear in human-readable\n> +\t\t# output as well as being passed to commands.\n> +\t\tgpg_sign_opt=\"-S$(git rev-parse --sq-quote \"${1#--gpg-sign=}\" |\n> +\t\t\tsed 's/^ //')\"\n\nIsn't an invocation of sed excessive?\n\n\tgpg_sign_opt=$(git rev-parse --sq-quote \"${1#--gpg-sign=}\") &&\n\tgpg_sign_opt=-S${gpg_sign_opt# }\n\nif you really need to strip the leading SP, which I do not think is\na necessary thing to do.  It is sufficient to remove the SP before\nthe variable substitution in the human-readable messages, e.g.\n\n\techo \"run this command: git commit$gpg_sign_opt\"\n\n\n> +\t\t;;\n>  \t--)\n>  \t\tshift\n>  \t\tbreak\n"},{"id":"234485","messageId":"20140207235058.GJ635004@vauxhall.crustytoothpaste.net","threadId":"35778","inReplyTo":"xmqqlhxrdgb5.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v3 8/9] rebase: add the --gpg-sign option","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-02-07T23:50:58Z","receivedAt":"2014-02-07T23:50:58Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, Feb 03, 2014 at 01:42:06PM -0800, Junio C Hamano wrote:\n> > +\t--gpg-sign)\n> > +\t\tgpg_sign_opt=-S\n> > +\t\t;;\n> > +\t--gpg-sign=*)\n> > +\t\t# Try to quote only the argument, as this will appear in human-readable\n> > +\t\t# output as well as being passed to commands.\n> > +\t\tgpg_sign_opt=\"-S$(git rev-parse --sq-quote \"${1#--gpg-sign=}\" |\n> > +\t\t\tsed 's/^ //')\"\n> \n> Isn't an invocation of sed excessive?\n> \n> \tgpg_sign_opt=$(git rev-parse --sq-quote \"${1#--gpg-sign=}\") &&\n> \tgpg_sign_opt=-S${gpg_sign_opt# }\n> \n> if you really need to strip the leading SP, which I do not think is\n> a necessary thing to do.  It is sufficient to remove the SP before\n> the variable substitution in the human-readable messages, e.g.\n\nI'm not sure that command line parsing of \"-S 'foo <x@example.tld>'\"\nwill work exactly as expected due to the fact that -S doesn't always\ntake an argument.  Your suggestion to use # seems fine, though.\n\nI'm a little embarrassed to admit that in my fifteen years of Unix\nexperience, I've never learned the variable modifiers for shell, so it\ndidn't occur to me to use them in this case.  Guess it's time to learn\nthem now.\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":"234504","messageId":"52F62B49.7080709@iee.org","threadId":"35778","inReplyTo":"20140207235058.GJ635004@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH v3 8/9] rebase: add the --gpg-sign option","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2014-02-08T13:04:09Z","receivedAt":"2014-02-08T13:04:09Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 07/02/14 23:50, brian m. carlson wrote:\n> On Mon, Feb 03, 2014 at 01:42:06PM -0800, Junio C Hamano wrote:\n>>> +\t--gpg-sign)\n>>> +\t\tgpg_sign_opt=-S\n>>> +\t\t;;\n>>> +\t--gpg-sign=*)\n>>> +\t\t# Try to quote only the argument, as this will appear in human-readable\n>>> +\t\t# output as well as being passed to commands.\n>>> +\t\tgpg_sign_opt=\"-S$(git rev-parse --sq-quote \"${1#--gpg-sign=}\" |\n>>> +\t\t\tsed 's/^ //')\"\n>>\n>> Isn't an invocation of sed excessive?\n>>\n>> \tgpg_sign_opt=$(git rev-parse --sq-quote \"${1#--gpg-sign=}\") &&\n>> \tgpg_sign_opt=-S${gpg_sign_opt# }\n>>\n>> if you really need to strip the leading SP, which I do not think is\n>> a necessary thing to do.  It is sufficient to remove the SP before\n>> the variable substitution in the human-readable messages, e.g.\n>\n> I'm not sure that command line parsing of \"-S 'foo <x@example.tld>'\"\n> will work exactly as expected due to the fact that -S doesn't always\n> take an argument.  Your suggestion to use # seems fine, though.\n>\n> I'm a little embarrassed to admit that in my fifteen years of Unix\n> experience, I've never learned the variable modifiers for shell, so it\n> didn't occur to me to use them in this case.  Guess it's time to learn\n> them now.\n\nSame here:\n\nFor other readers, I found most google results were only partial on the \nissue, missing the '#' symbol option. Here's a more complete ref \nhttp://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion-1 \nfor fellow learners.\n\nPhilip\n--\n\n>\n"}]}