Re: [PATCH] show-ref: Allow --head to work with --verify
- From
Vladimir Panteleev <thecybershadow@gmail.com>
- Date
- Jan 20, 2017, 20:51 UTC
- Message-ID
- <cf40c3e4-406d-f39f-ab72-812a88115100@gmail.com>
- In-Reply-To
- <1bf9a446-0b00-f27a-4625-0bc8c25356fe@gmail.com>
And to clarify:
On 2017-01-20 20:26, Vladimir Panteleev wrote:
> 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.
The behavior of --verify I am interested in is not to check that the ref exists, but to get its SHA1 while avoiding the pattern search. This avoids accidentally matching refs via substring (e.g. "git show-ref --head HEAD" will print HEAD, but also e.g. refs/remotes/origin/HEAD), and for performance reasons (looking up a ref by exact name can be MUCH faster than matching all refs by pattern search, e.g. in one of my projects where I use git as an object store, --verify makes a difference of 21 milliseconds vs. over 5 minutes).
-- Best regards, Vladimir