cache_or_unpack_entry: drop keep_cache parameter

There is only one caller of cache_or_unpack_entry() and it always passes 1 for the keep_cache parameter. We can simplify it by dropping the "!keep_cache" case. Another call, which did pass 0, was dropped in abe601b (sha1_file: remove recursion in unpack_entry, 2013-03-27), as unpack_entry() now does more complicated things than a simple unpack when there is a cache miss. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 22, 2016 at 17:57 UTC 85fe35ab9e0d6ded2afa7811e8f345d8dbe08907
1 file changed +3 -10
sha1_file.c
+3 -10
@@ -2129,25 +2129,18 @@ static void clear_delta_base_cache_entry(struct delta_base_cache_entry *ent)
2129 }
2130
2131 static void *cache_or_unpack_entry(struct packed_git *p, off_t base_offset,
2132 - unsigned long *base_size, enum object_type *type, int keep_cache)
2132 + unsigned long *base_size, enum object_type *type)
2133 {
2134 struct delta_base_cache_entry *ent;
2135 - void *ret;
2135
2136 ent = get_delta_base_cache_entry(p, base_offset);
2137
2138 if (!eq_delta_base_cache_entry(ent, p, base_offset))
2139 return unpack_entry(p, base_offset, type, base_size);
2140
2142 - ret = ent->data;
2143 -
2144 - if (!keep_cache)
2145 - clear_delta_base_cache_entry(ent);
2146 - else
2147 - ret = xmemdupz(ent->data, ent->size);
2141 *type = ent->type;
2142 *base_size = ent->size;
2150 - return ret;
2143 + return xmemdupz(ent->data, ent->size);
2144 }
2145
2146 static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
@@ -2755,7 +2748,7 @@ static void *read_packed_sha1(const unsigned char *sha1,
2748
2749 if (!find_pack_entry(sha1, &e))
2750 return NULL;
2758 - data = cache_or_unpack_entry(e.p, e.offset, size, type, 1);
2751 + data = cache_or_unpack_entry(e.p, e.offset, size, type);
2752 if (!data) {
2753 /*
2754 * We're probably in deep shit, but let's try to fetch