public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: "Niels Möller" <nisse@glasklarteknik.se>
To: git@vger.kernel.org
Subject: Unexpected effect of log.showSignature on tformat:%H.
Date: Tue, 19 Nov 2024 10:17:33 +0100	[thread overview]
Message-ID: <87cyirtweq.fsf@localhost> (raw)

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

             reply	other threads:[~2024-11-19  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19  9:17 Niels Möller [this message]
2024-11-19  9:37 ` Unexpected effect of log.showSignature on tformat:%H Junio C Hamano
2024-11-19 10:06   ` Niels Möller
2024-11-19 22:14 ` brian m. carlson
2024-11-21  9:08   ` Niels Möller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyirtweq.fsf@localhost \
    --to=nisse@glasklarteknik.se \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox