Browse Source

pack: move has_pack_index()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Tan 7 years ago committed by Junio C Hamano
parent
commit
f9a8672a81
  1. 2
      cache.h
  2. 8
      packfile.c
  3. 2
      packfile.h
  4. 8
      sha1_file.c

2
cache.h

@ -1226,8 +1226,6 @@ extern int has_object_file_with_flags(const struct object_id *oid, int flags); @@ -1226,8 +1226,6 @@ extern int has_object_file_with_flags(const struct object_id *oid, int flags);
*/
extern int has_loose_object_nonlocal(const unsigned char *sha1);

extern int has_pack_index(const unsigned char *sha1);

extern void assert_sha1_type(const unsigned char *sha1, enum object_type expect);

/* Helper to check and "touch" a file */

8
packfile.c

@ -1846,3 +1846,11 @@ int has_sha1_pack(const unsigned char *sha1) @@ -1846,3 +1846,11 @@ int has_sha1_pack(const unsigned char *sha1)
struct pack_entry e;
return find_pack_entry(sha1, &e);
}

int has_pack_index(const unsigned char *sha1)
{
struct stat st;
if (stat(sha1_pack_index_name(sha1), &st))
return 0;
return 1;
}

2
packfile.h

@ -122,4 +122,6 @@ extern int find_pack_entry(const unsigned char *sha1, struct pack_entry *e); @@ -122,4 +122,6 @@ extern int find_pack_entry(const unsigned char *sha1, struct pack_entry *e);

extern int has_sha1_pack(const unsigned char *sha1);

extern int has_pack_index(const unsigned char *sha1);

#endif

8
sha1_file.c

@ -1623,14 +1623,6 @@ int force_object_loose(const unsigned char *sha1, time_t mtime) @@ -1623,14 +1623,6 @@ int force_object_loose(const unsigned char *sha1, time_t mtime)
return ret;
}

int has_pack_index(const unsigned char *sha1)
{
struct stat st;
if (stat(sha1_pack_index_name(sha1), &st))
return 0;
return 1;
}

int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
{
if (!startup_info->have_repository)

Loading…
Cancel
Save