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

Re: Unexpected effect of log.showSignature on tformat:%H.

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 19, 2024, 22:14 UTC
Message-ID
<Zz0NsaM-KFRXzBp6@tapette.crustytoothpaste.net>
In-Reply-To
<87cyirtweq.fsf@localhost>
On 2024-11-19 at 09:17:33, Niels Möller wrote:
Show 23 quoted lines
> I had expected the output of git show -s --format='tformat:%H' to be
> always the same, and was surprised to find that scripts using this
> construction started to fail after I set log.showSignature true.
> 
> See filled out bugreport form below, including a repro script.
> 
> Regards,
> /Niels Möller
> 
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
>   git config --global log.showSignature true
> 
>   I'm trying this out to get to see in git log which commits are
>   signed.
> 
> What did you expect to happen? (Expected behavior)
> 
>   That git show -s --format='tformat:%H' SOME_COMMIT
>   should still output the commit hash and nothing more.

git show is a porcelain, and it can be affected by options, such as `log.showSignature`. If you want predictable behaviour, you need a plumbing command, whose behaviour isn't affected by configuration in this way. The equivalent to what you've requested is this:

    git rev-list --no-commit-header -1 -s --format='tformat:%H' SOME_COMMIT
I've confirmed that works correctly even if `log.showSignature` is set.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Niels MöllerNext: Niels Möller
Message 4 of 5 in “Unexpected effect of log.showSignature on tformat:%H.”
  1. Niels MöllerNov 19, 2024
  2. Junio C HamanoNov 19, 2024
  3. Niels MöllerNov 19, 2024
  4. brian m. carlsonNov 19, 2024
  5. Niels MöllerNov 21, 2024

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.