diff options
author | Jeff King <peff@peff.net> | 2016-10-03 19:47:28 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-03 21:03:14 -0700 |
commit | 8e3f52d77854a19cb3fd2adee40be84c8a8bdacc (patch) | |
tree | d342eca5c1880a5286108a8e12e71eee8ca2b44a /cache.h | |
parent | abbrev: auto size the default abbreviation (diff) | |
download | tgif-8e3f52d77854a19cb3fd2adee40be84c8a8bdacc.tar.xz |
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>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1204,7 +1204,6 @@ struct object_context { #define GET_SHA1_TREEISH 020 #define GET_SHA1_BLOB 040 #define GET_SHA1_FOLLOW_SYMLINKS 0100 -#define GET_SHA1_AUTOMATIC 0200 #define GET_SHA1_ONLY_TO_DIE 04000 #define GET_SHA1_DISAMBIGUATORS \ @@ -1456,6 +1455,12 @@ extern void prepare_packed_git(void); extern void reprepare_packed_git(void); extern void install_packed_git(struct packed_git *pack); +/* + * Give a rough count of objects in the repository. This sacrifices accuracy + * for speed. + */ +unsigned long approximate_object_count(void); + extern struct packed_git *find_sha1_pack(const unsigned char *sha1, struct packed_git *packs); |