Skip to content

Commit

Permalink
Add "has_sha1_pack()" function to query whether the object is availab…
Browse files Browse the repository at this point in the history
…le in a pack

We'll want this for incremental packing.
  • Loading branch information
Linus Torvalds committed Jul 3, 2005
1 parent c333038 commit dade09c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ extern int read_tree(void *buffer, unsigned long size, int stage);

extern int write_sha1_from_fd(const unsigned char *sha1, int fd);

extern int has_sha1_pack(const unsigned char *sha1);
extern int has_sha1_file(const unsigned char *sha1);

/* Convert to/from hex/sha1 representation */
Expand Down
6 changes: 6 additions & 0 deletions sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,12 @@ int write_sha1_from_fd(const unsigned char *sha1, int fd)
return 0;
}

int has_sha1_pack(const unsigned char *sha1)
{
struct pack_entry e;
return find_pack_entry(sha1, &e);
}

int has_sha1_file(const unsigned char *sha1)
{
struct stat st;
Expand Down

0 comments on commit dade09c

Please sign in to comment.