summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-12-13 15:06:40 -0500
committerJunio C Hamano <gitster@pobox.com>2008-12-13 18:55:55 -0800
commitbf874896240cb00b22cd4f6cbcc143b17cc7fe0e (patch)
tree9709b69f299ab2b9b207591402d49b0bfde82905 /builtin-pack-objects.c
parent43cc2b4266cc75f1a5a10e1a805d05e419000573 (diff)
downloadgit-bf874896240cb00b22cd4f6cbcc143b17cc7fe0e.tar.gz
pack-objects: don't use too many threads with few objects
If there are few objects to deltify, they might be split amongst threads so that there is simply no other objects left to delta against within the same thread. Let's use the same 2*window treshold as used for the final load balancing to allow extra threads to be created. This fixes the benign t5300 test failure. Signed-off-by: Nicolas Pitre <nico@cam.org> Tested-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 619e597d5c..e8515348be 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1620,6 +1620,10 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
for (i = 0; i < delta_search_threads; i++) {
unsigned sub_size = list_size / (delta_search_threads - i);
+ /* don't use too small segments or no deltas will be found */
+ if (sub_size < 2*window && i+1 < delta_search_threads)
+ sub_size = 0;
+
p[i].window = window;
p[i].depth = depth;
p[i].processed = processed;