summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2017-08-18 15:20:34 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-23 15:12:07 -0700
commitd6fe0036fd5e0cf7f51aa84381ebd321e898350a (patch)
treee3d0d3d4df44cc73a4b06bbdbc3dc52b1a720744
parenta2551953b9619b285128c1e9cf35120fb7555d8f (diff)
downloadgit-d6fe0036fd5e0cf7f51aa84381ebd321e898350a.tar.gz
pack: move find_sha1_pack()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--cache.h3
-rw-r--r--http-push.c1
-rw-r--r--http-walker.c1
-rw-r--r--packfile.c13
-rw-r--r--packfile.h3
-rw-r--r--sha1_file.c13
6 files changed, 18 insertions, 16 deletions
diff --git a/cache.h b/cache.h
index c13345d641..0f435cb3e5 100644
--- a/cache.h
+++ b/cache.h
@@ -1602,9 +1602,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 c91f40a610..e4c9b065ce 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 "packfile.h"
#ifdef EXPAT_NEEDS_XMLPARSE_H
#include <xmlparse.h>
diff --git a/http-walker.c b/http-walker.c
index ee049cb13d..1ae8363de2 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -4,6 +4,7 @@
#include "http.h"
#include "list.h"
#include "transport.h"
+#include "packfile.h"
struct alt_base {
char *base;
diff --git a/packfile.c b/packfile.c
index 20562304b7..135e95cb2e 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1774,3 +1774,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/packfile.h b/packfile.h
index 4ab15116c0..e4d25d40d1 100644
--- a/packfile.h
+++ b/packfile.h
@@ -42,6 +42,9 @@ extern void install_packed_git(struct packed_git *pack);
*/
unsigned long approximate_object_count(void);
+extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
+ struct packed_git *packs);
+
extern void pack_report(void);
/*
diff --git a/sha1_file.c b/sha1_file.c
index 365b4af367..af3f1e5c53 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1128,19 +1128,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)