[PATCH v3 22/23] pack: move has_pack_index()
From: Jonathan Tan <hidden>
Date: 2017-08-18 22:21:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Jonathan Tan <redacted> --- cache.h | 2 -- packfile.c | 8 ++++++++ packfile.h | 2 ++ sha1_file.c | 8 -------- 4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/cache.h b/cache.h
index 286891df4..dcbe37a3f 100644
--- a/cache.h
+++ b/cache.h@@ -1233,8 +1233,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 7472ab816..7e293761b 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 4945a1505..1b6ea832c 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 e4975e0ae..fa422435f 100644
--- a/sha1_file.c
+++ b/sha1_file.c@@ -1622,14 +1622,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)
--
2.14.1.480.gb18f417b89-goog