X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sha1_name.c;h=2d727d54dc43c23cb2fe19369d58e57e2a020ca9;hb=5701115aa7cfe7edd57c2483085456a37e27a5ba;hp=55f25a2d3b49b1d565a9840b7dcfb2e22687cdd3;hpb=76026200eee9fea016c2d87f472bb13cb15f47b2;p=git.git diff --git a/sha1_name.c b/sha1_name.c index 55f25a2d3..2d727d54d 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -76,8 +76,11 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne prepare_packed_git(); for (p = packed_git; p && found < 2; p = p->next) { - uint32_t num = p->num_objects; - uint32_t first = 0, last = num; + uint32_t num, last; + uint32_t first = 0; + open_pack_index(p); + num = p->num_objects; + last = num; while (first < last) { uint32_t mid = (first + last) / 2; const unsigned char *now; @@ -133,6 +136,7 @@ static int find_unique_short_object(int len, char *canonical, int has_unpacked, has_packed; unsigned char unpacked_sha1[20], packed_sha1[20]; + prepare_alt_odb(); has_unpacked = find_short_object_filename(len, canonical, unpacked_sha1); has_packed = find_short_packed_object(len, res, packed_sha1); if (!has_unpacked && !has_packed) @@ -366,7 +370,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1) fprintf(stderr, "warning: Log for '%.*s' only goes " "back to %s.\n", len, str, - show_rfc2822_date(co_time, co_tz)); + show_date(co_time, co_tz, DATE_RFC2822)); else fprintf(stderr, "warning: Log for '%.*s' only has " @@ -654,7 +658,6 @@ int get_sha1_with_mode(const char *name, unsigned char *sha1, unsigned *mode) const char *cp; *mode = S_IFINVALID; - prepare_alt_odb(); ret = get_sha1_1(name, namelen, sha1); if (!ret) return ret; @@ -679,8 +682,6 @@ int get_sha1_with_mode(const char *name, unsigned char *sha1, unsigned *mode) namelen = namelen - (cp - name); if (!active_cache) read_cache(); - if (active_nr < 0) - return -1; pos = cache_name_pos(cp, namelen); if (pos < 0) pos = -pos - 1;