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

Re: [PATCH] sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 26, 2014, 18:50 UTC
Message-ID
<xmqq7fyhre3b.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1416996767-12672-1-git-send-email-mh@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 6 quoted lines
> An example where this happens is when doing an ls-tree on a tree that
> contains a commit link. In that case, find_unique_abbrev is called
> to get a non-abbreviated hex sha1, but still, a lookup is done as
> to whether the sha1 is in the repository (which ends up looking for
> a loose object in .git/objects), while the result of that lookup is
> not used when returning a non-abbreviated hex sha1.

Makes sense. If we are not abbreviating, because the function is prepared to give answer for both missing and existing objects, there is no point checking the existence.

Thanks.
Previous: Mike Hommey
Message 2 of 2 in “sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev”
  1. sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrevMike Hommey, Nov 26, 2014
  2. Junio C HamanoNov 26, 2014

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.