summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef0316f)
raw | patch | inline | side by side (parent: ef0316f)
author | Nicolas Pitre <nico@cam.org> | |
Thu, 6 Sep 2007 06:13:10 +0000 (02:13 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 6 Sep 2007 07:01:44 +0000 (00:01 -0700) |
This is to help threadification of the delta search code, with a bonus
consistency check.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
consistency check.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c | patch | blob | history |
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b8495bf9247f69c58b1186b3965085b9532ed39e..9d565925e7133d5baad8c31e1303e99cf6ecf0a7 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
}
static void find_deltas(struct object_entry **list, unsigned list_size,
- unsigned nr_deltas, int window, int depth)
+ int window, int depth, unsigned *processed)
{
- uint32_t i = list_size, idx = 0, count = 0, processed = 0;
+ uint32_t i = list_size, idx = 0, count = 0;
unsigned int array_size = window * sizeof(struct unpacked);
struct unpacked *array;
unsigned long mem_usage = 0;
array = xmalloc(array_size);
memset(array, 0, array_size);
- if (progress)
- start_progress(&progress_state, "Deltifying %u objects...", "", nr_deltas);
do {
struct object_entry *entry = list[--i];
if (entry->preferred_base)
goto next;
+ (*processed)++;
if (progress)
- display_progress(&progress_state, ++processed);
+ display_progress(&progress_state, *processed);
/*
* If the current object is at pack edge, take the depth the
idx = 0;
} while (i > 0);
- if (progress)
- stop_progress(&progress_state);
-
for (i = 0; i < window; ++i) {
free_delta_index(array[i].index);
free(array[i].data);
}
if (nr_deltas) {
+ unsigned nr_done = 0;
+ if (progress)
+ start_progress(&progress_state,
+ "Deltifying %u objects...", "",
+ nr_deltas);
qsort(delta_list, n, sizeof(*delta_list), type_size_sort);
- find_deltas(delta_list, n, nr_deltas, window+1, depth);
+ find_deltas(delta_list, n, window+1, depth, &nr_done);
+ if (progress)
+ stop_progress(&progress_state);
+ if (nr_done != nr_deltas)
+ die("inconsistency with delta count");
}
free(delta_list);
}