git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
NMNiels Möller <nisse@glasklarteknik.se>
Date
Nov 19, 2024, 10:06 UTC
Message-ID
<878qtftu5e.fsf@localhost>
In-Reply-To
<xmqqmshvd0nn.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 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

Previous: Junio C HamanoNext: brian m. carlson
Message 3 of 5 in “Unexpected effect of log.showSignature on tformat:%H.”
  1. Niels MöllerNov 19, 2024
  2. Junio C HamanoNov 19, 2024
  3. Niels MöllerNov 19, 2024
  4. brian m. carlsonNov 19, 2024
  5. Niels MöllerNov 21, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.