git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-stash: Don't GPG sign when stashing changes

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 6, 2015, 18:56 UTC
Message-ID
<xmqqio5f2bz6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<00000150dddb0eeb-b77240fb-1b63-4676-ac4b-1220b8d011ca-000000@eu-west-1.amazonses.com>
Cameron Currie <me@cameroncurrie.net> writes:
> This is helpful for folks with commit.gpgsign = true in their .gitconfig.
> ---
>  git-stash.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

I have to wonder if the right fix is to change "git commit-tree" to ignore that configuration variable? After all, the plumbing commands are about stability of the interface, not convenience, and it feels wrong for them to be affected by end-user configurations.

Patching git-stash.sh does not help other scripts (either in-tree or third-party) that use commit-tree; they will also be broken by over-eager users who set commit.gpgsign configuration.

Show 35 quoted lines
>
> 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
Previous: Cameron CurrieNext: daurnimator
Message 2 of 12 in “git-stash: Don't GPG sign when stashing changes”
  1. git-stash: Don't GPG sign when stashing changesCameron Currie, Nov 6, 2015
  2. Junio C HamanoNov 6, 2015
  3. daurnimatorApr 7, 2016
  4. Johannes SchindelinApr 7, 2016
  5. DaurnimatorApr 12, 2016
  6. git-stash: Don't GPG sign when stashing changesCameron Currie, May 2, 2016
  7. Junio C HamanoMay 2, 2016
  8. DaurnimatorMay 2, 2016
  9. Junio C HamanoMay 3, 2016
  10. DaurnimatorMay 6, 2016
  11. Johannes SchindelinApr 14, 2016
  12. DaurnimatorMay 2, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.