summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 62af0b5)
raw | patch | inline | side by side (parent: 62af0b5)
author | Lukas Sandström <lukass@etek.chalmers.se> | |
Fri, 18 Nov 2005 22:00:55 +0000 (23:00 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 18 Nov 2005 23:34:17 +0000 (15:34 -0800) |
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
pack-redundant.c | patch | blob | history |
diff --git a/pack-redundant.c b/pack-redundant.c
index 3e3f33a80e9786a4330beb0afdfe869d355c8275..fb6cb48502fe9316d9cd46fb4f191e143aa811fa 100644 (file)
--- a/pack-redundant.c
+++ b/pack-redundant.c
}
/* this scales like O(n^2) */
-void cmp_packs()
+void cmp_local_packs()
{
struct pack_list *subset, *pl = local_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;
+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;
}
- pl = pl->next;
+ alt = alt->next;
}
}
size_t off;
void *base;
+ if (!p->pack_local && !(alt_odb || verbose))
+ return NULL;
+
l.pack = p;
llist_init(&l.all_objects);
base = (void *)p->index_base;
while (off <= p->index_size - 3 * 20) {
llist_insert_back(l.all_objects, base + off);
- off+=24;
+ off += 24;
}
/* this list will be pruned in cmp_two_packs later */
l.unique_objects = llist_copy(l.all_objects);
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)
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));