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.