From: Patrick Steinhardt <ps@pks.im>
To: "Erik Östlund" <erik.ostlund@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Pinned references?
Date: Fri, 19 Jun 2026 09:38:30 +0200 [thread overview]
Message-ID: <ajTx9vLIWK5wvTHM@pks.im> (raw)
In-Reply-To: <CANE2Nt_LP9odF9tVsy8di54eSH=QJxif2WQfHC+TQGGFeVcjvg@mail.gmail.com>
On Thu, Jun 18, 2026 at 08:37:26PM +0200, Erik Östlund wrote:
> I'd like to be able to express a reference together with an expected
> object ID, for example with strawman syntax like:
>
> refs/tags/v1.2.3?oid=a1b2c3d4
>
> The intended semantics would be that both the reference and object ID
> must exist, and Git should fail if the reference does not resolve to the
> specified object ID.
>
> Tags are nice because they convey human meaning. Object IDs are nice
> because they are immutable. As it is, I often have to choose between the
> two, or represent them separately in external tooling.
>
> Is there existing terminology, prior discussion, or an accepted Git-native
> approach for this kind of "ref plus expected OID" invariant? I
> searched both the Git reference documentation and the mailing list
> archives, but couldn't find what I was looking for.
You can already kind of do this:
$ git rev-parse v2.54.0
0b13e48a3a30cdfa94e8ef842e24d6045ab3d015
$ git rev-parse v2.54.0-0-g0b13e48a3
0b13e48a3a30cdfa94e8ef842e24d6045ab3d015
$ git rev-parse v2.54.0-0-g95e20213f
95e20213faefeb95df29277c58ac1980ab68f701
This is described under gitrevisions(7), `<describeOutput>`. The only
gotcha is that this format will not verify that the tag and the object
ID actually match. But other than that it gives you the ability to have
both the human-readable name and the machine-readable commit ID in
there.
As said, we don't verify that those two revisions actually match. So in
the case where they don't the result is certainly going to be lots of
confusion. It certainly is one of the more surprising syntaxes that we
have in Git.
Patrick
next prev parent reply other threads:[~2026-06-19 7:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 18:37 Pinned references? Erik Östlund
2026-06-19 7:38 ` Patrick Steinhardt [this message]
2026-06-19 16:25 ` Junio C Hamano
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=ajTx9vLIWK5wvTHM@pks.im \
--to=ps@pks.im \
--cc=erik.ostlund@gmail.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox