[PATCH v2 21/25] pack: move find_sha1_pack()
From: Jonathan Tan <hidden>
Date: 2017-08-09 01:23:51
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Jonathan Tan <redacted> --- cache.h | 3 --- http-push.c | 1 + http-walker.c | 1 + pack.h | 3 +++ packfile.c | 13 +++++++++++++ sha1_file.c | 13 ------------- 6 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/cache.h b/cache.h
index b944aca69..06a8caae6 100644
--- a/cache.h
+++ b/cache.h@@ -1600,9 +1600,6 @@ struct pack_entry { struct packed_git *p; }; -extern struct packed_git *find_sha1_pack(const unsigned char *sha1, - struct packed_git *packs); - /* * Create a temporary file rooted in the object database directory, or * die on failure. The filename is taken from "pattern", which should have the
diff --git a/http-push.c b/http-push.c
index c91f40a61..4e8a227d1 100644
--- a/http-push.c
+++ b/http-push.c@@ -11,6 +11,7 @@ #include "list-objects.h" #include "sigchain.h" #include "argv-array.h" +#include "pack.h" #ifdef EXPAT_NEEDS_XMLPARSE_H #include <xmlparse.h>
diff --git a/http-walker.c b/http-walker.c
index ee049cb13..d6f0af944 100644
--- a/http-walker.c
+++ b/http-walker.c@@ -4,6 +4,7 @@ #include "http.h" #include "list.h" #include "transport.h" +#include "pack.h" struct alt_base { char *base;
diff --git a/pack.h b/pack.h
index f5bd94813..0517d6542 100644
--- a/pack.h
+++ b/pack.h@@ -218,4 +218,7 @@ extern off_t find_pack_entry_one(const unsigned char *sha1, struct packed_git *) extern int is_pack_valid(struct packed_git *); +extern struct packed_git *find_sha1_pack(const unsigned char *sha1, + struct packed_git *packs); + #endif
diff --git a/packfile.c b/packfile.c
index 71017d2ec..f16b56262 100644
--- a/packfile.c
+++ b/packfile.c@@ -1783,3 +1783,16 @@ int is_pack_valid(struct packed_git *p) /* Force the pack to open to prove its valid. */ return !open_packed_git(p); } + +struct packed_git *find_sha1_pack(const unsigned char *sha1, + struct packed_git *packs) +{ + struct packed_git *p; + + for (p = packs; p; p = p->next) { + if (find_pack_entry_one(sha1, p)) + return p; + } + return NULL; + +}
diff --git a/sha1_file.c b/sha1_file.c
index 75b9ceb39..229358663 100644
--- a/sha1_file.c
+++ b/sha1_file.c@@ -1126,19 +1126,6 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e) return 0; } -struct packed_git *find_sha1_pack(const unsigned char *sha1, - struct packed_git *packs) -{ - struct packed_git *p; - - for (p = packs; p; p = p->next) { - if (find_pack_entry_one(sha1, p)) - return p; - } - return NULL; - -} - static int sha1_loose_object_info(const unsigned char *sha1, struct object_info *oi, int flags)
--
2.14.0.434.g98096fd7a8-goog