]> git.ipfire.org Git - thirdparty/git.git/commit - sha1-name.c
find_unique_abbrev: move logic out of get_short_sha1()
authorJeff King <peff@peff.net>
Mon, 3 Oct 2016 23:47:28 +0000 (19:47 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 4 Oct 2016 04:03:14 +0000 (21:03 -0700)
commit8e3f52d77854a19cb3fd2adee40be84c8a8bdacc
treed342eca5c1880a5286108a8e12e71eee8ca2b44a
parente6c587c733b4634030b353f4024794b08bc86892
find_unique_abbrev: move logic out of get_short_sha1()

The get_short_sha1() is only about reading short sha1s; we
do call it in a loop to check "is this long enough" for each
object, but otherwise it should not need to know about
things like our default_abbrev setting.

So instead of asking it to set default_automatic_abbrev as a
side-effect, let's just have find_unique_abbrev() pick the
right place to start its loop.  This requires a separate
approximate_object_count() function, but that naturally
belongs with the rest of sha1_file.c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h
sha1_file.c
sha1_name.c