pack: move find_sha1_pack()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan committed
Aug 18, 2017 at 15:20 UTC
d6fe0036fd5e0cf7f51aa84381ebd321e898350a
6 files changed
+18
-16
cache.h
-3
@@ -1602,9 +1602,6 @@ struct pack_entry {
1602
struct packed_git *p;
1603
};
1604
1605
-extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
1606
- struct packed_git *packs);
1607
-
1605
/*
1606
* Create a temporary file rooted in the object database directory, or
1607
* die on failure. The filename is taken from "pattern", which should have the
http-push.c
+1
@@ -11,6 +11,7 @@
11
#include "list-objects.h"
12
#include "sigchain.h"
13
#include "argv-array.h"
14
+#include "packfile.h"
15
16
#ifdef EXPAT_NEEDS_XMLPARSE_H
17
#include <xmlparse.h>
http-walker.c
+1
@@ -4,6 +4,7 @@
4
#include "http.h"
5
#include "list.h"
6
#include "transport.h"
7
+#include "packfile.h"
8
9
struct alt_base {
10
char *base;
packfile.c
+13
@@ -1774,3 +1774,16 @@ int is_pack_valid(struct packed_git *p)
1774
/* Force the pack to open to prove its valid. */
1775
return !open_packed_git(p);
1776
}
1777
+
1778
+struct packed_git *find_sha1_pack(const unsigned char *sha1,
1779
+ struct packed_git *packs)
1780
+{
1781
+ struct packed_git *p;
1782
+
1783
+ for (p = packs; p; p = p->next) {
1784
+ if (find_pack_entry_one(sha1, p))
1785
+ return p;
1786
+ }
1787
+ return NULL;
1788
+
1789
+}
packfile.h
+3
@@ -42,6 +42,9 @@ extern void install_packed_git(struct packed_git *pack);
42
*/
43
unsigned long approximate_object_count(void);
44
45
+extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
46
+ struct packed_git *packs);
47
+
48
extern void pack_report(void);
49
50
/*
sha1_file.c
-13
@@ -1128,19 +1128,6 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
1128
return 0;
1129
}
1130
1131
-struct packed_git *find_sha1_pack(const unsigned char *sha1,
1132
- struct packed_git *packs)
1133
-{
1134
- struct packed_git *p;
1135
-
1136
- for (p = packs; p; p = p->next) {
1137
- if (find_pack_entry_one(sha1, p))
1138
- return p;
1139
- }
1140
- return NULL;
1141
-
1142
-}
1143
-
1131
static int sha1_loose_object_info(const unsigned char *sha1,
1132
struct object_info *oi,
1133
int flags)