summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-02-28 08:00:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-28 09:06:06 (GMT)
commit03a9683d22eca52bc2b2b9b09258a143e76416f6 (patch)
tree9be24a9a25e8e2702f1e27a35b0504d273ecd445 /sha1_file.c
parent386cb77210cdb09cd808698d21d0e796cd77f26f (diff)
downloadgit-03a9683d22eca52bc2b2b9b09258a143e76416f6.zip
git-03a9683d22eca52bc2b2b9b09258a143e76416f6.tar.gz
git-03a9683d22eca52bc2b2b9b09258a143e76416f6.tar.bz2
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.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 6e0a462..e8a9517 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;