diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-02-28 00:00:21 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-28 01:06:06 -0800 |
commit | 03a9683d22eca52bc2b2b9b09258a143e76416f6 (patch) | |
tree | 9be24a9a25e8e2702f1e27a35b0504d273ecd445 /sha1_file.c | |
parent | 386cb77210cdb09cd808698d21d0e796cd77f26f (diff) | |
download | git-03a9683d22eca52bc2b2b9b09258a143e76416f6.tar.gz |
Simplify is_kept_pack()
This removes --unpacked=<packfile> parameter from the revision parser, and
rewrites its use in git-repack to pass a single --kept-pack-only option
instead.
The new --kept-pack-only option means just that. When this option is
given, is_kept_pack() that used to say "not on the --unpacked=<packfile>
list" now says "the packfile has corresponding .keep file".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/sha1_file.c b/sha1_file.c index 6e0a462f10..e8a9517d01 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1858,33 +1858,9 @@ off_t find_pack_entry_one(const unsigned char *sha1, return 0; } -static int matches_pack_name(const struct packed_git *p, const char *name) +int is_kept_pack(const struct packed_git *p) { - const char *last_c, *c; - - if (!strcmp(p->pack_name, name)) - return 1; - - for (c = p->pack_name, last_c = c; *c;) - if (*c == '/') - last_c = ++c; - else - ++c; - if (!strcmp(last_c, name)) - return 1; - - return 0; -} - -int is_kept_pack(const struct packed_git *p, const struct rev_info *revs) -{ - int i; - - for (i = 0; i < revs->num_ignore_packed; i++) { - if (matches_pack_name(p, revs->ignore_packed[i])) - return 0; - } - return 1; + return p->pack_keep; } static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e, @@ -1900,7 +1876,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->ignore_packed && !is_kept_pack(p, revs)) + if (revs->kept_pack_only && !is_kept_pack(p)) goto next; if (p->num_bad_objects) { unsigned i; |