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

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

From
NMNiels Möller <nisse@glasklarteknik.se>
Date
Nov 19, 2024, 09:17 UTC
Message-ID
<87cyirtweq.fsf@localhost>

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. 
What happened instead? (Actual behavior)
  I get an extra "No signature" line in the output (on stdout, not
  stderr), when looking at a signed commit.
What's different between what you expected and what actually happened?
  The extra output line.
Anything else you want to add:
Here's a small script to reproduce the problem:

-----8<----- #! /bin/sh

set -eu

export GIT_CONFIG_GLOBAL="$(pwd)/git.config" git config --global log.showSignature true

git clone https://git.glasklar.is/glasklar/trust/audit-log.git cd audit-log

hash=$(git show -s --format='tformat:%H' e36424e5688572c196d658a5df8c04c20de7606a)

echo "Hash is: |$hash|" -----8<-----

This is what it looks when I run it:

-----8<----- $ ./repro.sh Cloning into 'audit-log'... remote: Enumerating objects: 143, done. remote: Counting objects: 100% (8/8), done. remote: Compressing objects: 100% (8/8), done. remote: Total 143 (delta 1), reused 0 (delta 0), pack-reused 135 (from 1) Receiving objects: 100% (143/143), 347.00 MiB | 107.22 MiB/s, done. Resolving deltas: 100% (59/59), done. error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification Hash is: |No signature e36424e5688572c196d658a5df8c04c20de7606a| -----8<-----

I would have expected the output
Hash is: |e36424e5688572c196d658a5df8c04c20de7606a|

[System Info] git version: git version 2.39.5 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.40 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks] not run from a git repository - no hooks to show

Next: Junio C Hamano
Message 1 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.