summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-08-18 15:20:37 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-23 15:12:07 -0700
commitf9a8672a81277b83cabd59c6705089351c4f3ec4 (patch)
tree35cc126bff3151f8ecc74e3bc96b6318370fa526
parent150e3001d0c5cc69db72a10f3e0cd1e14f11acba (diff)
downloadgit-f9a8672a81277b83cabd59c6705089351c4f3ec4.tar.gz
pack: move has_pack_index()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--cache.h2
-rw-r--r--packfile.c8
-rw-r--r--packfile.h2
-rw-r--r--sha1_file.c8
4 files changed, 10 insertions, 10 deletions
diff --git a/cache.h b/cache.h
index a2897bc7d1..c057d3fed3 100644
--- a/cache.h
+++ b/cache.h
@@ -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 */
diff --git a/packfile.c b/packfile.c
index 322c43d74a..84d16bf7e0 100644
--- a/packfile.c
+++ b/packfile.c
@@ -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;
+}
diff --git a/packfile.h b/packfile.h
index 420fcdb2b9..d7df41a823 100644
--- a/packfile.h
+++ b/packfile.h
@@ -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
diff --git a/sha1_file.c b/sha1_file.c
index 32f4867289..7c81790759 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -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)