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

Re: git name-rev not accepting abbreviated SHA with --stdin

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 4, 2015, 02:03 UTC
Message-ID
<CAPc5daVFRuBsZEZO=y5hY=ErQf7uy36Ejw2CLb3s8N5y6+T_ww@mail.gmail.com>
In-Reply-To
<5597365E.7070508@gmail.com>
On Fri, Jul 3, 2015 at 6:26 PM, Sitaram Chamarty <sitaramc@gmail.com> wrote:
> Jokes apart, I'm not sure the chances of *both* those things happening
> -- an accidental hash-like string in the text *and* it matching an
> existing hash -- are high enough to bother.  If it can be done without
> too much code, it probably should.

To be fair to the original implementor, I think we didn't have an API to ask "do we have a committish object with this name?" with an abbreviated SHA-1. All we had was "do we have an object with this name?".

As the only answer the command can give is an exteneded SHA-1 for committish, it is understandable that hitting blobs and trees (which typically are much more numerous than committishes) with false positives would have been a real risk the implementation wanted to avoid.

Previous: Sitaram Chamarty
Message 6 of 6 in “git name-rev not accepting abbreviated SHA with --stdin”
  1. Sitaram ChamartyJun 24, 2015
  2. Junio C HamanoJun 25, 2015
  3. Sitaram ChamartyJun 25, 2015
  4. Junio C HamanoJul 3, 2015
  5. Sitaram ChamartyJul 4, 2015
  6. Junio C HamanoJul 4, 2015

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.