Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Maxim Iorsh <iorsh@users.sourceforge.net>
Cc: git@vger.kernel.org
Subject: Re: Bug: git log with log.showSignature enabled
Date: Sat, 6 Jan 2024 18:21:55 +0000	[thread overview]
Message-ID: <ZZmaQ0RoxJpU2PSH@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <CADQ_TR56X_iMitPEiaOyR_h=1dp9ThUQMu_Vqjest1i8xbh9Tw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2506 bytes --]

On 2024-01-06 at 16:56:29, Maxim Iorsh wrote:
> 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)
> 
> iorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline
> 2aa98f6a5 (HEAD -> master) Dummy signed commit
> iorsh-linux:~/devel/fontforge/build> git config log.showSignature true
> iorsh-linux:~/devel/fontforge/build> git log -n 1 --oneline
> 2aa98f6a5 (HEAD -> master) gpg: Signature made 17:47:50 2024 ינו 06 ש' IST
> gpg:                using RSA key XXXXXXXXXX
> gpg:                issuer "iorsh@users.sourceforge.net"
> gpg: Good signature from "Maxim Iorsh <iorsh@users.sourceforge.net>" [ultimate]
> Dummy signed commit
> 
> What did you expect to happen? (Expected behavior)
> 
> When asked for oneliner or any specific format, `git log` shouldn't
> show signature event when configured.
> 
> What happened instead? (Actual behavior)
> 
> `git log` always show signatures with log.showSignature enabled, even
> for explicit formatting requests.
> 
> What's different between what you expected and what actually happened?
> 
> Anything else you want to add:
> 
> This behavior obviously breaks any script which relies on git log to
> produce preformatted info about commits. It's also quite rare, becaus
> e probably very few users set log.showSignature config option.

I think this is behaving as designed.  git log is a porcelain command,
which means it's designed for the user to use, but is not intended for
scripting.  The documentation for `log.showSignature` says this:

  If true, makes git-log(1), git-show(1), and git-whatchanged(1) assume --show-signature.

As long as the output is what you would have gotten if you manually
added --show-signature, the result is correct.

However, if you want to script things, you can use git rev-list, which
is a plumbing command that's specifically designed to allow scripting.
It works very similarly to git log, but doesn't have configuration
options that change its behaviour, so it doesn't suffer from this
problem.

For example, on one of my branches, I get this:

$ git rev-list -n 1 --oneline HEAD
404bf1f83a credential: add an argument to keep state

Note that the implicit HEAD of git log doesn't work with git rev-list,
so you need to specify HEAD explicitly.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

      reply	other threads:[~2024-01-06 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-06 16:56 Bug: git log with log.showSignature enabled Maxim Iorsh
2024-01-06 18:21 ` brian m. carlson [this message]

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=ZZmaQ0RoxJpU2PSH@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=iorsh@users.sourceforge.net \
    /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