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