diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-02-28 00:37:19 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-28 01:06:06 -0800 |
commit | 69e020ae00ebd3f7ae3c2f35acb139361417ef64 (patch) | |
tree | e5d700170a0604ee30f3317fc93f816c6d2a1a30 /sha1_file.c | |
parent | 03a9683d22eca52bc2b2b9b09258a143e76416f6 (diff) | |
download | git-69e020ae00ebd3f7ae3c2f35acb139361417ef64.tar.gz |
is_kept_pack(): final clean-up
Now is_kept_pack() is just a member lookup into a structure, we can write
it as such.
Also rewrite the sole caller of has_sha1_kept_pack() to switch on the
criteria the callee uses (namely, revs->kept_pack_only) between calling
has_sha1_kept_pack() and has_sha1_pack(), so that these two callees do not
have to take a pointer to struct rev_info as an argument.
This removes the header file dependency issue temporarily introduced by
the earlier commit, so we revert changes associated to that as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sha1_file.c b/sha1_file.c index e8a9517d01..7ead56cc3e 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -16,8 +16,6 @@ #include "refs.h" #include "pack-revindex.h" #include "sha1-lookup.h" -#include "diff.h" -#include "revision.h" #ifndef O_NOATIME #if defined(__linux__) && (defined(__i386__) || defined(__PPC__)) @@ -1858,13 +1856,8 @@ off_t find_pack_entry_one(const unsigned char *sha1, return 0; } -int is_kept_pack(const struct packed_git *p) -{ - return p->pack_keep; -} - static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e, - const struct rev_info *revs) + int kept_pack_only) { static struct packed_git *last_found = (void *)1; struct packed_git *p; @@ -1876,7 +1869,7 @@ static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e, p = (last_found == (void *)1) ? packed_git : last_found; do { - if (revs->kept_pack_only && !is_kept_pack(p)) + if (kept_pack_only && !p->pack_keep) goto next; if (p->num_bad_objects) { unsigned i; @@ -1919,13 +1912,12 @@ static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e, static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e) { - return find_pack_ent(sha1, e, NULL); + return find_pack_ent(sha1, e, 0); } -static int find_kept_pack_entry(const unsigned char *sha1, struct pack_entry *e, - const struct rev_info *revs) +static int find_kept_pack_entry(const unsigned char *sha1, struct pack_entry *e) { - return find_pack_ent(sha1, e, revs); + return find_pack_ent(sha1, e, 1); } struct packed_git *find_sha1_pack(const unsigned char *sha1, @@ -2395,10 +2387,10 @@ int has_sha1_pack(const unsigned char *sha1) return find_pack_entry(sha1, &e); } -int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *revs) +int has_sha1_kept_pack(const unsigned char *sha1) { struct pack_entry e; - return find_kept_pack_entry(sha1, &e, revs); + return find_kept_pack_entry(sha1, &e); } int has_sha1_file(const unsigned char *sha1) |