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

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
Previous: Vladimir PanteleevNext: Junio C Hamano
Message 4 of 11 in “show-ref: Allow --head to work with --verify”
  1. show-ref: Allow --head to work with --verifyVladimir Panteleev, Jan 20, 2017
  2. Junio C HamanoJan 20, 2017
  3. Vladimir PanteleevJan 20, 2017
  4. Vladimir PanteleevJan 20, 2017
  5. Junio C HamanoJan 20, 2017
  6. Junio C HamanoJan 20, 2017
  7. Junio C HamanoJan 20, 2017
  8. Vladimir PanteleevJan 20, 2017
  9. Junio C HamanoJan 20, 2017
  10. Junio C HamanoJan 20, 2017
  11. Vladimir PanteleevJan 21, 2017

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.