Thread (1 message) 1 message, 1 author, 2024-11-19

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

From: Niels Möller <hidden>
Date: 2024-11-19 10:06:28

Junio C Hamano [off-list ref] writes:
It is a bit unexpected, but knowing how the command options evolved,
it is not all that surprising X-<.  If you are using --format, you
are expected to use the %G placeholder and friends when you are
interested in signatures.
The thing is, I'm generally interested in signatures when using git
interactively (that's why I enabled log.showSignature globally). But
then I have a scripted usecase that has a tag name, and needs to query
the corresponding commit hash, and in that context, I don't care about
signatures at all. The docs for git show say that %H expands to the
commit hash, which is exactly what I want. I didn't know about the %G
formats, but after a quick look at the docs, I don't think they solves
that problem.

I can work around this problem by using "export
GIT_CONFIG_GLOBAL=/dev/null" in the script, which I guess might be
generally good practice when using git in scripts? But I still think it
would be useful if there were an easy and reliable way to get from tag
to commit hash, regardless of the user's config settings.

Regards,
/Niels Möller
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help