From: Vladimir Panteleev <thecybershadow@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] show-ref: Allow --head to work with --verify
Date: Fri, 20 Jan 2017 20:26:44 +0000 [thread overview]
Message-ID: <1bf9a446-0b00-f27a-4625-0bc8c25356fe@gmail.com> (raw)
In-Reply-To: <xmqqa8aly2o4.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On 2017-01-20 19:03, Junio C Hamano wrote:
> Having said all that, using --verify on HEAD does not make much
> sense, because if HEAD is missing in .git/, I do not think Git
> considers that directory as a Git repository to begin with. So from
> that point of view, I am not sure what value this change adds to the
> system, even though the change is almost correct (modulo the "quiet"
> thing).
My use case was the following series of steps:
Q1: How do I resolve a full ref name to a commit SHA1?
A1: Use show-ref <full-ref-name>.
Q2: How to make git show-ref also work when HEAD is specified as the
reference?
A2: Add --head.
Q3: How do I make git show-ref only look for the exact full ref name
specified, instead of doing a pattern/substring search, and thus output
at most one result?
A3: Add --verify.
However, A2 and A3 are incompatible. Thus, there doesn't seem to be a
way to e.g. make a simple alias which looks up a ref only by its full
ref name, where said ref might or might not be HEAD. The obvious
workaround is to check if the ref is HEAD in the rev-parse caller,
however it seemed more logical to fix it in git instead.
The documentation for show-ref also makes no mention that --head is
ignored if --verify is specified, and the combination was not covered by
any tests, therefore this seemed to me as a simple omission in
--verify's logic.
There is also rev-parse, which also has a --verify switch, however it
does something else, and I don't see a way to ask rev-parse to only
consider full refs.
--
Best regards,
Vladimir
next prev parent reply other threads:[~2017-01-20 20:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 15:50 [PATCH] show-ref: Allow --head to work with --verify Vladimir Panteleev
2017-01-20 19:03 ` Junio C Hamano
2017-01-20 20:26 ` Vladimir Panteleev [this message]
2017-01-20 20:51 ` Vladimir Panteleev
2017-01-20 22:22 ` Junio C Hamano
2017-01-20 22:31 ` Junio C Hamano
2017-01-20 23:15 ` Junio C Hamano
2017-01-20 22:55 ` Vladimir Panteleev
2017-01-20 23:20 ` Junio C Hamano
2017-01-20 23:29 ` Junio C Hamano
2017-01-21 0:25 ` Vladimir Panteleev
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=1bf9a446-0b00-f27a-4625-0bc8c25356fe@gmail.com \
--to=thecybershadow@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).