Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
  • Loading branch information
brian m. carlson authored and Jeff King committed Nov 20, 2015
1 parent 0c83680 commit b419aa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cache.h
Expand Up @@ -1030,6 +1030,9 @@ static inline int has_sha1_file(const unsigned char *sha1)
return has_sha1_file_with_flags(sha1, 0);
}

/* Same as the above, except for struct object_id. */
extern int has_object_file(const struct object_id *oid);

/*
* Return true iff an alternate object database has a loose object
* with the specified name. This function does not respect replace
Expand Down
5 changes: 5 additions & 0 deletions sha1_file.c
Expand Up @@ -3216,6 +3216,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
return find_pack_entry(sha1, &e);
}

int has_object_file(const struct object_id *oid)
{
return has_sha1_file(oid->hash);
}

static void check_tree(const void *buf, size_t size)
{
struct tree_desc desc;
Expand Down

0 comments on commit b419aa2

Please sign in to comment.