Skip to content

Commit b419aa2

Browse files
bk2204peff
authored andcommitted
sha1_file: introduce has_object_file helper.
Add has_object_file, which is a wrapper around has_sha1_file, but for struct object_id. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent 0c83680 commit b419aa2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

cache.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,9 @@ static inline int has_sha1_file(const unsigned char *sha1)
10301030
return has_sha1_file_with_flags(sha1, 0);
10311031
}
10321032

1033+
/* Same as the above, except for struct object_id. */
1034+
extern int has_object_file(const struct object_id *oid);
1035+
10331036
/*
10341037
* Return true iff an alternate object database has a loose object
10351038
* with the specified name. This function does not respect replace

sha1_file.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
32163216
return find_pack_entry(sha1, &e);
32173217
}
32183218

3219+
int has_object_file(const struct object_id *oid)
3220+
{
3221+
return has_sha1_file(oid->hash);
3222+
}
3223+
32193224
static void check_tree(const void *buf, size_t size)
32203225
{
32213226
struct tree_desc desc;

0 commit comments

Comments
 (0)