Improve the readability of git-pack-redundant

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Lukas Sandström 2005-11-18 23:00:55 +01:00 committed by Junio C Hamano
parent 62af0b532b
commit 06a45c8cc9

View File

@ -497,7 +497,7 @@ void load_all_objects()
}
/* this scales like O(n^2) */
void cmp_packs()
void cmp_local_packs()
{
struct pack_list *subset, *pl = local_packs;
@ -506,16 +506,21 @@ void cmp_packs()
cmp_two_packs(pl, subset);
pl = pl->next;
}
pl = altodb_packs;
while (pl) {
subset = local_packs;
while (subset) {
llist_sorted_difference_inplace(subset->unique_objects,
pl->all_objects);
subset = subset->next;
}
pl = pl->next;
void scan_alt_odb_packs()
{
struct pack_list *local, *alt;
alt = altodb_packs;
while (alt) {
local = local_packs;
while (local) {
llist_sorted_difference_inplace(local->unique_objects,
alt->all_objects);
local = local->next;
}
alt = alt->next;
}
}
@ -525,6 +530,9 @@ struct pack_list * add_pack(struct packed_git *p)
size_t off;
void *base;
if (!p->pack_local && !(alt_odb || verbose))
return NULL;
l.pack = p;
llist_init(&l.all_objects);
@ -539,7 +547,7 @@ struct pack_list * add_pack(struct packed_git *p)
if (p->pack_local)
return pack_list_insert(&local_packs, &l);
else
return alt_odb ? pack_list_insert(&altodb_packs, &l) : NULL;
return pack_list_insert(&altodb_packs, &l);
}
struct pack_list * add_pack_file(char *filename)
@ -607,11 +615,14 @@ int main(int argc, char **argv)
if (local_packs == NULL)
die("Zero packs found!\n");
cmp_packs();
load_all_objects();
cmp_local_packs();
if (alt_odb)
scan_alt_odb_packs();
minimize(&min);
if (verbose) {
fprintf(stderr, "There are %lu packs available in alt-odbs.\n",
(unsigned long)pack_list_size(altodb_packs));