Adding --gpg-sign to cherry-pick, revert, am, rebase
Hello,
Here is a series of patches to add the --gpg-sign option to be able to gpg sign commits, to the cherry-pick, revert, am and rebase commands.
Nicolas
PATCH 1/8 cherry-pick, revert: add the --gpg-sign option
--- Documentation/git-cherry-pick.txt | 7 ++++++- Documentation/git-revert.txt | 6 +++++- builtin/revert.c | 2 ++ sequencer.c | 7 +++++++ sequencer.h | 2 ++ 5 files changed, 22 insertions(+), 2 deletions(-)
Documentation/git-cherry-pick.txt +6 -1
@@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS -------- [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[<keyid>]] <commit>... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort
@@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will
Documentation/git-revert.txt +5 -1
@@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS -------- [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>... 'git revert' --continue 'git revert' --quit 'git revert' --abort
@@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message.
builtin/revert.c +2 -0
@@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)OPT_STRING (0 ,"strategy" , &opts->strategy,N_ ("strategy" ),N_ ("merge strategy" )),OPT_CALLBACK ('X' ,"strategy-option" , &opts,N_ ("option" ),N_ ("option for merge strategy" ), option_parse_x), + { OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key id"), + N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },OPT_END (),OPT_END (), OPT_END(),
sequencer.c +7 -0
@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, {struct argv_array array;int rc; +char *gpg_sign;argv_array_init (&array);argv_array_push (&array,"commit" );argv_array_push (&array,"-n" ); +if (opts->gpg_sign) { + gpg_sign =xmalloc (3 +strlen (opts->gpg_sign)); +sprintf (gpg_sign,"-S%s" , opts->gpg_sign); +argv_array_push (&array, gpg_sign); +free (gpg_sign); + }if (opts->signoff)argv_array_push (&array,"-s" );if (!opts->edit) {
sequencer.h +2 -0
@@ -37,6 +37,8 @@ struct replay_opts {int mainline; +const char *gpg_sign; +/* Merge strategy */ const char *strategy;const char **xopts;
Signature · 1 line
1.8.4.2
Re: [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option
sequencer.h struct replay_opts { · line 44
Quoted 13 lines · Nicolas Vigier
sequencer.h +2
-0@@ -37,6 +37,8 @@ struct replay_opts {int mainline; +const char *gpg_sign; +/* Merge strategy */ const char *strategy;const char **xopts;
One thing you're missing here is the ability to save and retrieve the options. You might be cherry-picking or reverting multiple commits and get interrupted (maybe one is already applied) and need to use --continue.
So populate_options_cb and save_opts need to learn about this sequencer option so that after --continue, commits continue to get signed.
Signature · 3 lines
brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
PATCH 1/1 cherry-pick, revert: add the --gpg-sign option
--- Documentation/git-cherry-pick.txt | 7 ++++++- Documentation/git-revert.txt | 6 +++++- builtin/revert.c | 2 ++ sequencer.c | 11 +++++++++++ sequencer.h | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-)
Documentation/git-cherry-pick.txt +6 -1
@@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits SYNOPSIS -------- [verse] -'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>... +'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] + [-S[<keyid>]] <commit>... 'git cherry-pick' --continue 'git cherry-pick' --quit 'git cherry-pick' --abort
@@ -100,6 +101,10 @@ effect to your index in a row. --signoff:: Add Signed-off-by line at the end of the commit message. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + --ff:: If the current HEAD is the same as the parent of the cherry-pick'ed commit, then a fast forward to this commit will
Documentation/git-revert.txt +5 -1
@@ -8,7 +8,7 @@ git-revert - Revert some existing commits SYNOPSIS -------- [verse] -'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>... +'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>... 'git revert' --continue 'git revert' --quit 'git revert' --abort
@@ -80,6 +80,10 @@ more details. This is useful when reverting more than one commits' effect to your index in a row. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + -s:: --signoff:: Add Signed-off-by line at the end of the commit message.
builtin/revert.c +2 -0
@@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)OPT_STRING (0 ,"strategy" , &opts->strategy,N_ ("strategy" ),N_ ("merge strategy" )),OPT_CALLBACK ('X' ,"strategy-option" , &opts,N_ ("option" ),N_ ("option for merge strategy" ), option_parse_x), + { OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key id"), + N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },OPT_END (),OPT_END (), OPT_END(),
sequencer.c +11 -0
@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, {struct argv_array array;int rc; +char *gpg_sign;argv_array_init (&array);argv_array_push (&array,"commit" );argv_array_push (&array,"-n" ); +if (opts->gpg_sign) { + gpg_sign =xmalloc (3 +strlen (opts->gpg_sign)); +sprintf (gpg_sign,"-S%s" , opts->gpg_sign); +argv_array_push (&array, gpg_sign); +free (gpg_sign); + }if (opts->signoff)argv_array_push (&array,"-s" );if (!opts->edit) {
@@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts->mainline =git_config_int (key, value); else if (!strcmp(key, "options.strategy"))git_config_string (&opts->strategy, key, value); + else if (!strcmp(key, "options.gpg-sign")) +git_config_string (&opts->gpg_sign, key, value); else if (!strcmp(key, "options.strategy-option")) {ALLOC_GROW (opts->xopts, opts->xopts_nr +1 , opts->xopts_alloc); opts->xopts[opts->xopts_nr++] =xstrdup (value);
@@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) }if (opts->strategy)git_config_set_in_file (opts_file,"options.strategy" , opts->strategy); +if (opts->gpg_sign) +git_config_set_in_file (opts_file,"options.gpg-sign" , opts->gpg_sign);if (opts->xopts) {int i;for (i =0 ; i < opts->xopts_nr; i++)
sequencer.h +2 -0
@@ -37,6 +37,8 @@ struct replay_opts {int mainline; +const char *gpg_sign; +/* Merge strategy */ const char *strategy;const char **xopts;
Signature · 1 line
1.8.4.2
Re: [PATCH] cherry-pick, revert: add the --gpg-sign option
Quoted 33 lines · Nicolas Vigier
sequencer.c +9
-0@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, {struct argv_array array;int rc; +char *gpg_sign;argv_array_init (&array);argv_array_push (&array,"commit" );argv_array_push (&array,"-n" ); +if (opts->gpg_sign) { + gpg_sign =xmalloc (3 +strlen (opts->gpg_sign)); +sprintf (gpg_sign,"-S%s" , opts->gpg_sign); +argv_array_push (&array, gpg_sign); +free (gpg_sign); + }if (opts->signoff)argv_array_push (&array,"-s" );if (!opts->edit) {@@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char *value, void *data) opts->mainline =git_config_int (key, value); else if (!strcmp(key, "options.strategy"))git_config_string (&opts->strategy, key, value); + else if (!strcmp(key, "options.gpg-sign")) +git_config_string (&opts->gpg_sign, key, value); else if (!strcmp(key, "options.strategy-option")) {ALLOC_GROW (opts->xopts, opts->xopts_nr +1 , opts->xopts_alloc); opts->xopts[opts->xopts_nr++] =xstrdup (value);
sequencer.c static void save_opts(struct replay_opts *opts) · line 997
Quoted 8 lines
sequencer.c +2
-0@@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts) }if (opts->strategy)git_config_set_in_file (opts_file,"options.strategy" , opts->strategy); +if (opts->gpg_sign) +git_config_set_in_file (opts_file,"options.gpg-sign" , opts->gpg_sign);if (opts->xopts) {int i;for (i =0 ; i < opts->xopts_nr; i++)
Looks much better. That's essentially what I did when I was patching that particular area. Thanks for posting this patch set; it's something I've wanted for a while, but never got around to actually doing myself.
Signature · 3 lines
brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Re: [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option
In reply to brian m. carlsonQuoted 20 lines · brian m. carlson
sequencer.h struct replay_opts { · line 44
Quoted 13 lines · Nicolas Vigier
sequencer.h +2
-0@@ -37,6 +37,8 @@ struct replay_opts {int mainline; +const char *gpg_sign; +/* Merge strategy */ const char *strategy;const char **xopts;One thing you're missing here is the ability to save and retrieve the options. You might be cherry-picking or reverting multiple commits and get interrupted (maybe one is already applied) and need to use --continue.
Quoted 2 lines
So
populate_options_cbandsave_optsneed to learn about this sequencer option so that after --continue, commits continue to get signed.
Ah indeed, I didn't think about that. I will look at it. Thanks.
PATCH 2/8 git-sh-setup.sh: add variable to use the stuck-long mode
In reply to Nicolas VigierIf the variable $OPTIONS_STUCKLONG is not empty, then rev-parse option parsing is done in --stuck-long mode.
--- contrib/examples/git-checkout.sh | 1 + contrib/examples/git-clean.sh | 1 + contrib/examples/git-clone.sh | 1 + contrib/examples/git-merge.sh | 1 + contrib/examples/git-repack.sh | 1 + contrib/git-resurrect.sh | 1 + git-am.sh | 1 + git-instaweb.sh | 1 + git-quiltimport.sh | 1 + git-rebase.sh | 1 + git-request-pull.sh | 1 + git-sh-setup.sh | 2 ++ 12 files changed, 13 insertions(+)
contrib/examples/git-checkout.sh +1 -0
@@ -1,6 +1,7 @@ #!/bin/sh OPTIONS_KEEPDASHDASH=t +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git-checkout [options] [<branch>] [<paths>...] --
contrib/examples/git-clean.sh +1 -0
@@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git-clean [options] <paths>...
contrib/examples/git-clone.sh +1 -0
@@ -8,6 +8,7 @@ # See git-sh-setup why. unset CDPATH +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git-clone [options] [--] <repo> [<dir>] --
contrib/examples/git-merge.sh +1 -0
@@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git merge [options] <remote>... git merge [options] <msg> HEAD <remote>
contrib/examples/git-repack.sh +1 -0
@@ -4,6 +4,7 @@ # OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git repack [options] --
contrib/git-resurrect.sh +1 -0
@@ -10,6 +10,7 @@ is rather slow but allows you to resurrect other people's topic branches." OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git resurrect $USAGE --
git-am.sh +1 -0
@@ -4,6 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git am [options] [(<mbox>|<Maildir>)...] git am [options] (--continue | --skip | --abort)
git-instaweb.sh +1 -0
@@ -5,6 +5,7 @@ PERL='@@PERL@@' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git instaweb [options] (--start | --stop | --restart) --
git-quiltimport.sh +1 -0
@@ -1,5 +1,6 @@ #!/bin/sh OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git quiltimport [options] --
git-rebase.sh +1 -0
@@ -5,6 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC="\ git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>] git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]
git-request-pull.sh +1 -0
@@ -9,6 +9,7 @@ LONG_USAGE='Summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.' SUBDIRECTORY_OK='Yes' OPTIONS_KEEPDASHDASH= +OPTIONS_STUCKLONG= OPTIONS_SPEC='git request-pull [options] start url [end] -- p show patch text as well
git-sh-setup.sh +2 -0
@@ -75,6 +75,8 @@ if test -n "$OPTIONS_SPEC"; then parseopt_extra= [ -n "$OPTIONS_KEEPDASHDASH" ] && parseopt_extra="--keep-dashdash" + [ -n "$OPTIONS_STUCKLONG" ] && + parseopt_extra="$parseopt_extra --stuck-long" eval "$( echo "$OPTIONS_SPEC" |
Signature · 1 line
1.8.4.2
PATCH 3/8 am: parse options in stuck-long mode
In reply to Nicolas VigierThere is no functionnal change. The reason for this change is to be able to add a new option taking an optional argument.
--- git-am.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
git-am.sh +9 -9
@@ -4,7 +4,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC="\ git am [options] [(<mbox>|<Maildir>)...] git am [options] (--continue | --skip | --abort)
@@ -414,14 +414,14 @@ it will be removed. Please do not use it anymore." abort=t ;; --rebasing) rebasing=t threeway=t ;; - --resolvemsg) - shift; resolvemsg=$1 ;; - --whitespace|--directory|--exclude|--include) - git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;; - -C|-p) - git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;; - --patch-format) - shift ; patch_format="$1" ;; + --resolvemsg=*) + resolvemsg="${1#--resolvemsg=}" ;; + --whitespace=*|--directory=*|--exclude=*|--include=*) + git_apply_opt="$git_apply_opt $(sq "$1")" ;; + -C*|-p*) + git_apply_opt="$git_apply_opt $(sq "$1")" ;; + --patch-format=*) + patch_format="${1#--patch-format=}" ;; --reject|--ignore-whitespace|--ignore-space-change) git_apply_opt="$git_apply_opt $1" ;; --committer-date-is-author-date)
Signature · 1 line
1.8.4.2
PATCH 4/8 am: add the --gpg-sign option
In reply to Nicolas Vigier--- Documentation/git-am.txt | 6 +++++- git-am.sh | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-)
Documentation/git-am.txt +5 -1
@@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>] [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet] - [--[no-]scissors] + [--[no-]scissors] [-S[<keyid>]] [(<mbox> | <Maildir>)...] 'git am' (--continue | --skip | --abort)
@@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + --continue:: -r:: --resolved::
git-am.sh +8 -1
@@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-date lie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase)" . git-sh-setup
@@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test "$(git config --bool --get am.keepcr)" = true then
@@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore." keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt="-S${1#--gpg-sign=}" ;; --) shift; break ;; *)
@@ -900,7 +906,8 @@ did you forget to use 'git add'?" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" export GIT_COMMITTER_DATE fi && - git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit" + git commit-tree ${gpg_sign_opt:+"$gpg_sign_opt"} $tree ${parent:+-p} $parent \ + <"$dotest/final-commit" ) && git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent || stop_here $this
Signature · 1 line
1.8.4.2
PATCH 1/1 am: add the --gpg-sign option
---
Second version of this patch. In the first version I forgot to save the status of the gpg-sign option so that it is also used with --continue.
Documentation/git-am.txt | 6 +++++- git-am.sh | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-)
Documentation/git-am.txt +5 -1
@@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--ignore-space-change | --ignore-whitespace] [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>] [--exclude=<path>] [--include=<path>] [--reject] [-q | --quiet] - [--[no-]scissors] + [--[no-]scissors] [-S[<keyid>]] [(<mbox> | <Maildir>)...] 'git am' (--continue | --skip | --abort)
@@ -119,6 +119,10 @@ default. You can use `--no-utf8` to override this. Skip the current patch. This is only meaningful when restarting an aborted patch. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + --continue:: -r:: --resolved::
git-am.sh +10 -1
@@ -38,6 +38,7 @@ abort restore the original branch and abort the patching operation. committer-date-is-author-date lie about committer date ignore-date use current timestamp for author date rerere-autoupdate update the index with reused conflict resolution if possible +S,gpg-sign? GPG-sign commits rebasing* (internal use for git-rebase)" . git-sh-setup
@@ -375,6 +376,7 @@ git_apply_opt= committer_date_is_author_date= ignore_date= allow_rerere_autoupdate= +gpg_sign_opt= if test "$(git config --bool --get am.keepcr)" = true then
@@ -436,6 +438,10 @@ it will be removed. Please do not use it anymore." keepcr=t ;; --no-keep-cr) keepcr=f ;; + --gpg-sign) + gpg_sign_opt=-S ;; + --gpg-sign=*) + gpg_sign_opt="-S${1#--gpg-sign=}" ;; --) shift; break ;; *)
@@ -564,6 +570,7 @@ Use \"git am --abort\" to remove it.")" echo "$scissors" >"$dotest/scissors" echo "$no_inbody_headers" >"$dotest/no_inbody_headers" echo "$GIT_QUIET" >"$dotest/quiet" + echo "$gpg_sign_opt" >"$dotest/gpg-sign-opt" echo 1 >"$dotest/next" if test -n "$rebasing" then
@@ -645,6 +652,7 @@ then else SIGNOFF= fi +gpg_sign_opt=$(cat "$dotest/gpg-sign-opt") last=`cat "$dotest/last"` this=`cat "$dotest/next"`
@@ -900,7 +908,8 @@ did you forget to use 'git add'?" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" export GIT_COMMITTER_DATE fi && - git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit" + git commit-tree ${gpg_sign_opt:+"$gpg_sign_opt"} $tree ${parent:+-p} $parent \ + <"$dotest/final-commit" ) && git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent || stop_here $this
Signature · 1 line
1.8.4.2
PATCH 5/8 rebase: remove useless arguments check
In reply to Nicolas VigierRemove a check on the number of arguments for --onto and -x options. It is not possible for $# to be <= 2 at this point :
- if --onto or -x has an argument, git rev-parse --parseopt will provide something like this :
set -- --onto 'x' --
when parsing the "--onto" option, $# will be 3 or more if there are other options.
- if --onto or -x doesn't have an argument, git rev-parse --parseopt will exit with an error and display usage information.
--- git-rebase.sh | 2 -- 1 file changed, 2 deletions(-)
git-rebase.sh +0 -2
@@ -236,12 +236,10 @@ do action=${1##--} ;; --onto) - test 2 -le "$#" || usage onto="$2" shift ;; -x) - test 2 -le "$#" || usage cmd="${cmd}exec $2${LF}" shift ;;
Signature · 1 line
1.8.4.2
PATCH 6/8 rebase: don't try to match -M option
In reply to Nicolas VigierThe -M option does not exist in OPTIONS_SPEC, so there is no use to try to find it.
--- git-rebase.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
git-rebase.sh +1 -1
@@ -259,7 +259,7 @@ do --no-autosquash) autosquash= ;; - -M|-m) + -m) do_merge=t ;; -X)
Signature · 1 line
1.8.4.2
PATCH 7/8 rebase: parse options in stuck-long mode
In reply to Nicolas VigierThere is no functionnal change. The reason for this change is to be able to add a new option taking an optional argument.
--- git-rebase.sh | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-)
git-rebase.sh +22 -28
@@ -5,7 +5,7 @@ SUBDIRECTORY_OK=Yes OPTIONS_KEEPDASHDASH= -OPTIONS_STUCKLONG= +OPTIONS_STUCKLONG=t OPTIONS_SPEC="\ git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>] git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]
@@ -235,21 +235,19 @@ do test $total_argc -eq 2 || usage action=${1##--} ;; - --onto) - onto="$2" - shift + --onto=*) + onto="${1#--onto=}" ;; - -x) - cmd="${cmd}exec $2${LF}" - shift + --exec=*) + cmd="${cmd}exec ${1#--exec=}${LF}" ;; - -i) + --interactive) interactive_rebase=explicit ;; - -k) + --keep-empty) keep_empty=yes ;; - -p) + --preserve-merges) preserve_merges=t test -z "$interactive_rebase" && interactive_rebase=implied ;;
@@ -259,21 +257,19 @@ do --no-autosquash) autosquash= ;; - -m) + --merge) do_merge=t ;; - -X) - shift - strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--$1")" + --strategy-option=*) + strategy_opts="$strategy_opts $(git rev-parse --sq-quote "--${1#--strategy-option=}")" do_merge=t test -z "$strategy" && strategy=recursive ;; - -s) - shift - strategy="$1" + --strategy=*) + strategy="${1#--strategy=}" do_merge=t ;; - -n) + --no-stat) diffstat= ;; --stat)
@@ -282,21 +278,20 @@ do --autostash) autostash=true ;; - -v) + --verbose) verbose=t diffstat=t GIT_QUIET= ;; - -q) + --quiet) GIT_QUIET=t git_am_opt="$git_am_opt -q" verbose= diffstat= ;; - --whitespace) - shift - git_am_opt="$git_am_opt --whitespace=$1" - case "$1" in + --whitespace=*) + git_am_opt="$git_am_opt --whitespace=${1#--whitespace=}" + case "${1#--whitespace=}" in fix|strip) force_rebase=t ;;
@@ -309,14 +304,13 @@ do git_am_opt="$git_am_opt $1" force_rebase=t ;; - -C) - shift - git_am_opt="$git_am_opt -C$1" + -C*) + git_am_opt="$git_am_opt $1" ;; --root) rebase_root=t ;; - -f|--no-ff) + --force-rebase|--no-ff) force_rebase=t ;; --rerere-autoupdate|--no-rerere-autoupdate)
Signature · 1 line
1.8.4.2
PATCH 8/8 rebase: add the --gpg-sign option
In reply to Nicolas Vigier--- Documentation/git-rebase.txt | 4 ++++ git-rebase--am.sh | 8 +++++--- git-rebase--interactive.sh | 32 ++++++++++++++++++++------------ git-rebase--merge.sh | 2 +- git-rebase.sh | 11 +++++++++++ 5 files changed, 41 insertions(+), 16 deletions(-)
Documentation/git-rebase.txt +4 -0
@@ -281,6 +281,10 @@ which makes little sense. specified, `-s recursive`. Note the reversal of 'ours' and 'theirs' as noted above for the `-m` option. +-S[<keyid>]:: +--gpg-sign[=<keyid>]:: + GPG-sign commits. + -q:: --quiet:: Be quiet. Implies --no-stat.
git-rebase--am.sh +5 -3
@@ -5,7 +5,8 @@ case "$action" in continue) - git am --resolved --resolvemsg="$resolvemsg" && + git am --resolved --resolvemsg="$resolvemsg" \ + ${gpg_sign_opt:+"$gpg_sign_opt"} && move_to_original_branch return ;;
@@ -25,7 +26,7 @@ then # empty commits and even if it didn't the format doesn't really lend # itself well to recording empty patches. fortunately, cherry-pick # makes this easy - git cherry-pick --allow-empty "$revisions" + git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty "$revisions" ret=$? else rm -f "$GIT_DIR/rebased-patches"
@@ -59,7 +60,8 @@ else return $? fi - git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches" + git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \ + ${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches" ret=$? rm -f "$GIT_DIR/rebased-patches"
git-rebase--interactive.sh +20 -12
@@ -184,7 +184,7 @@ exit_with_patch () { git rev-parse --verify HEAD > "$amend" warn "You can amend the commit now, with" warn - warn " git commit --amend" + warn " git commit --amend $gpg_sign_opt" warn warn "Once you are satisfied with your changes, run" warn
@@ -251,7 +251,8 @@ pick_one () { test -d "$rewritten" && pick_one_preserving_merges "$@" && return - output eval git cherry-pick "$strategy_args" $empty_args $ff "$@" + output eval git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} \ + "$strategy_args" $empty_args $ff "$@" } pick_one_preserving_merges () {
@@ -362,7 +363,8 @@ pick_one_preserving_merges () { echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list" ;; *) - output eval git cherry-pick "$strategy_args" "$@" || + output eval git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} \ + "$strategy_args" "$@" || die_with_patch $sha1 "Could not pick $sha1" ;; esac
@@ -473,7 +475,8 @@ do_pick () { --no-post-rewrite -n -q -C $1 && pick_one -n $1 && git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 || + --amend --no-post-rewrite -n -q -C $1 \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die_with_patch $1 "Could not apply $1... $2" else pick_one $1 ||
@@ -500,7 +503,7 @@ do_next () { mark_action_done do_pick $sha1 "$rest" - git commit --amend --no-post-rewrite || { + git commit --amend --no-post-rewrite ${gpg_sign_opt:+"$gpg_sign_opt"} || { warn "Could not amend commit after successfully picking $sha1... $rest" warn "This is most likely due to an empty commit message, or the pre-commit hook" warn "failed. If the pre-commit hook failed, you may need to resolve the issue before"
@@ -545,19 +548,22 @@ do_next () { squash|s|fixup|f) # This is an intermediate commit; its message will only be # used in case of trouble. So use the long version: - do_with_author output git commit --amend --no-verify -F "$squash_msg" || + do_with_author output git commit --amend --no-verify -F "$squash_msg" \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die_failed_squash $sha1 "$rest" ;; *) # This is the final command of this squash/fixup group if test -f "$fixup_msg" then - do_with_author git commit --amend --no-verify -F "$fixup_msg" || + do_with_author git commit --amend --no-verify -F "$fixup_msg" \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die_failed_squash $sha1 "$rest" else cp "$squash_msg" "$GIT_DIR"/SQUASH_MSG || exit rm -f "$GIT_DIR"/MERGE_MSG - do_with_author git commit --amend --no-verify -F "$GIT_DIR"/SQUASH_MSG -e || + do_with_author git commit --amend --no-verify -F "$GIT_DIR"/SQUASH_MSG -e \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die_failed_squash $sha1 "$rest" fi rm -f "$squash_msg" "$fixup_msg"
@@ -825,11 +831,11 @@ continue) die "You have staged changes in your working tree. If these changes are meant to be squashed into the previous commit, run: - git commit --amend + git commit --amend $gpg_sign_opt If they are meant to go into a new commit, run: - git commit + git commit $gpg_sign_opt In both case, once you're done, continue with:
@@ -845,10 +851,12 @@ In both case, once you're done, continue with: die "\ You have uncommitted changes in your working tree. Please, commit them first and then run 'git rebase --continue' again." - do_with_author git commit --amend --no-verify -F "$msg" -e || + do_with_author git commit --amend --no-verify -F "$msg" -e \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die "Could not commit staged changes." else - do_with_author git commit --no-verify -F "$msg" -e || + do_with_author git commit --no-verify -F "$msg" -e \ + ${gpg_sign_opt:+"$gpg_sign_opt"} || die "Could not commit staged changes." fi fi
git-rebase--merge.sh +1 -1
@@ -25,7 +25,7 @@ continue_merge () { cmt=`cat "$state_dir/current"` if ! git diff-index --quiet --ignore-submodules HEAD -- then - if ! git commit --no-verify -C "$cmt" + if ! git commit ${gpg_sign_opt:+"$gpg_sign_opt"} --no-verify -C "$cmt" then echo "Commit failed, please do not call \"git commit\"" echo "directly, but instead do one of the following: "
git-rebase.sh +11 -0
@@ -36,6 +36,7 @@ ignore-date! passed to 'git am' whitespace=! passed to 'git apply' ignore-whitespace! passed to 'git apply' C=! passed to 'git apply' +S,gpg-sign? GPG-sign commits Actions: continue! continue abort! abort and check out the original branch
@@ -83,6 +84,7 @@ preserve_merges= autosquash= keep_empty= test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t +gpg_sign_opt= read_basic_state () { test -f "$state_dir/head-name" &&
@@ -105,6 +107,8 @@ read_basic_state () { strategy_opts="$(cat "$state_dir"/strategy_opts)" test -f "$state_dir"/allow_rerere_autoupdate && allow_rerere_autoupdate="$(cat "$state_dir"/allow_rerere_autoupdate)" + test -f "$state_dir"/gpg_sign_opt && + gpg_sign_opt="$(cat "$state_dir"/gpg_sign_opt)" } write_basic_state () {
@@ -118,6 +122,7 @@ write_basic_state () { "$state_dir"/strategy_opts test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \ "$state_dir"/allow_rerere_autoupdate + test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt } output () {
@@ -316,6 +321,12 @@ do --rerere-autoupdate|--no-rerere-autoupdate) allow_rerere_autoupdate="$1" ;; + --gpg-sign) + gpg_sign_opt=-S + ;; + --gpg-sign=*) + gpg_sign_opt="-S${1#--gpg-sign=}" + ;; --) shift break
Signature · 1 line
1.8.4.2
Quoted 4 lines · Nicolas Vigier
Hello,
Here is a series of patches to add the --gpg-sign option to be able to gpg sign commits, to the cherry-pick, revert, am and rebase commands.
Whatever happened to this series? It looks like it never made it into next, master, or pu, and Junio's immediately-following "What's cooking" email didn't mention it.
I'm really very interested in seeing it merged, so if there's something I can do to help it along, please let me know.
Signature · 3 lines
brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187