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

Re: Re* [PATCH] commit-tree: do not pay attention to commit.gpgsign

From
Jeff King <peff@peff.net>
Date
May 3, 2016, 18:58 UTC
Message-ID
<20160503185802.GB30530@sigill.intra.peff.net>
In-Reply-To
<xmqqfutznhqw.fsf_-_@gitster.mtv.corp.google.com>
On Tue, May 03, 2016 at 11:01:11AM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> Ignoring commit.gpgsign option _obviously_ breaks the backward
> compatibility, but it is easy to follow the standard pattern in
> scripts to honor whatever configuration variable they choose to
> follow.  E.g.
> 
> 	case $(git config --bool commit.gpgsign) in
> 	true) sign=-S ;;
> 	*) sign= ;;
> 	esac &&
> 	git commit-tree $sign ...whatever other args...
> 
> Do so to make sure that "git rebase" keeps paying attention to the
> configuration variable, which unfortunately is a documented mistake.
> 
> Helped-by: Jeff King <peff@peff.net>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Documentation/git-commit-tree.txt |  4 ++--
>  builtin/commit-tree.c             |  4 ----
>  git-rebase.sh                     |  5 ++++-
>  t/t7510-signed-commit.sh          | 13 ++++++++++---
>  4 files changed, 16 insertions(+), 10 deletions(-)

Thanks, this looks good to me[1]. Especially thinking about the rebase case you handle here makes me more convinced than ever that an option like "--respect-commit-gpgsign-config" is the wrong path. Because the ultimate fate for rebase may be something like:

  case $(git config --bool rebase.gpgsign) in
  true) sign=-S ;;
  false) sign= ;;
  *)
	case $(git config --bool commit.gpgsign) in
	true) sign=-S ;;
	*) sign= ;;
	esac
	;;
  esac

You _can_ implement that by falling back to --respect... in the "*" case, but at that point it is not saving much code, and merely making things unnecessarily confusing.

-Peff
[1] I will say that I am happy with rebase respecting commit.gpgsign
    myself. The config I want is really "sign all commits I create", so
    I'd end up setting rebase.gpgsign, too, if it existed. But maybe
    other people have different workflows.
Previous: Junio C Hamano
Message 4 of 4 in “commit-tree: do not pay attention to commit.gpgsign”
  1. commit-tree: do not pay attention to commit.gpgsignJunio C Hamano, May 2, 2016
  2. Jeff KingMay 3, 2016
  3. Re* [PATCH] commit-tree: do not pay attention to commit.gpgsignJunio C Hamano, May 3, 2016
  4. Jeff KingMay 3, 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.