Re: [PATCH v2] git-stash: Don't GPG sign when stashing changes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 2, 2016, 21:57 UTC
- Message-ID
- <xmqqoa8oqg19.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <01020154733c27e9-deaa7a20-1de6-416a-a7d4-3229854117eb-000000@eu-west-1.amazonses.com>
Cameron Currie <me@cameroncurrie.net> writes:
> This is helpful for folks with commit.gpgsign = true in their .gitconfig. > > Signed-off-by: Cameron Currie <me@cameroncurrie.net> > ---
I do not think this is particularly a good change.
There are a few other in-tree users of "git commit-tree", e.g. quiltimport and filter-branch, and their users would be hurt the same way if they set commit.gpgsign in the configuration.
I think it was a mistake that "commit-tree" was made to pay attention to the configuration variable in the first place. Allowing scripts that use commit-tree to explicitly pass -S to it is perfectly fine (and these calling scripts are welcome to honor commit.gpgsign by reading the configration themselves if their users want it that way).
I'll send a pair of proposed alternative solutions shortly.
Show 37 quoted lines
> git-stash.sh | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/git-stash.sh b/git-stash.sh
> index c7c65e2..fcf01b9 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -85,7 +85,7 @@ create_stash () {
> # state of the index
> i_tree=$(git write-tree) &&
> i_commit=$(printf 'index on %s\n' "$msg" |
> - git commit-tree $i_tree -p $b_commit) ||
> + git commit-tree --no-gpg-sign $i_tree -p $b_commit) ||
> die "$(gettext "Cannot save the current index state")"
>
> if test -n "$untracked"
> @@ -99,7 +99,7 @@ create_stash () {
> rm -f "$TMPindex" &&
> git update-index -z --add --remove --stdin &&
> u_tree=$(git write-tree) &&
> - printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree &&
> + printf 'untracked files on %s\n' "$msg" | git commit-tree --no-gpg-sign $u_tree &&
> rm -f "$TMPindex"
> ) ) || die "Cannot save the untracked files"
>
> @@ -153,7 +153,7 @@ create_stash () {
> stash_msg=$(printf 'On %s: %s' "$branch" "$stash_msg")
> fi
> w_commit=$(printf '%s\n' "$stash_msg" |
> - git commit-tree $w_tree -p $b_commit -p $i_commit $untracked_commit_option) ||
> + git commit-tree --no-gpg-sign $w_tree -p $b_commit -p $i_commit $untracked_commit_option) ||
> die "$(gettext "Cannot record working tree state")"
> }
>
>
> --
> https://github.com/git/git/pull/186