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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-11-19 at 09:17:33, Niels Möller wrote:
> 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux