All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niels Möller" <nisse@glasklarteknik.se>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Unexpected effect of log.showSignature on tformat:%H.
Date: Tue, 19 Nov 2024 11:06:21 +0100	[thread overview]
Message-ID: <878qtftu5e.fsf@localhost> (raw)
In-Reply-To: <xmqqmshvd0nn.fsf@gitster.g> (Junio C. Hamano's message of "Tue, 19 Nov 2024 18:37:48 +0900")

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

  reply	other threads:[~2024-11-19 10:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19  9:17 Unexpected effect of log.showSignature on tformat:%H Niels Möller
2024-11-19  9:37 ` Junio C Hamano
2024-11-19 10:06   ` Niels Möller [this message]
2024-11-19 22:14 ` brian m. carlson
2024-11-21  9:08   ` Niels Möller

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=878qtftu5e.fsf@localhost \
    --to=nisse@glasklarteknik.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.