Skip to content

Commit 129cb1b

Browse files
pks-tgitster
authored andcommitted
hash: drop (mostly) unused is_empty_{blob,tree}_sha1() functions
The functions `is_empty_{blob,tree}_sha1()` are mostly unused, except for a single callsite in "read-cache.c". Most callsites have long since been converted to use the equivalents that accept a `struct object_id` instead of a string. Adapt the remaining callsite and drop those functions. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 10aa7c7 commit 129cb1b

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

hash.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,11 @@ static inline void oidread(struct object_id *oid, const unsigned char *hash)
8484
oidread_algop(oid, hash, the_hash_algo);
8585
}
8686

87-
static inline int is_empty_blob_sha1(const unsigned char *sha1)
88-
{
89-
return hasheq(sha1, the_hash_algo->empty_blob->hash);
90-
}
91-
9287
static inline int is_empty_blob_oid(const struct object_id *oid)
9388
{
9489
return oideq(oid, the_hash_algo->empty_blob);
9590
}
9691

97-
static inline int is_empty_tree_sha1(const unsigned char *sha1)
98-
{
99-
return hasheq(sha1, the_hash_algo->empty_tree->hash);
100-
}
101-
10292
static inline int is_empty_tree_oid(const struct object_id *oid)
10393
{
10494
return oideq(oid, the_hash_algo->empty_tree);

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int ce_match_stat_basic(const struct cache_entry *ce, struct stat *st)
337337

338338
/* Racily smudged entry? */
339339
if (!ce->ce_stat_data.sd_size) {
340-
if (!is_empty_blob_sha1(ce->oid.hash))
340+
if (!is_empty_blob_oid(&ce->oid))
341341
changed |= DATA_CHANGED;
342342
}
343343

0 commit comments

Comments
 (0)