Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2010-02-08 18:39:01 +0300
committerJunio C Hamano <gitster@pobox.com>2010-02-08 21:56:21 +0300
commit720c9f7bda20d8f307745772374647c1a2076b3d (patch)
tree9ee5753432d01904f1a8f5f987abfcd9e0422180 /builtin-pack-objects.c
parent8051a030617cf7d083568cca223bdaa15052c33f (diff)
Revert "pack-objects: fix pack generation when using pack_size_limit"
This reverts most of commit a2430dde8ceaaaabf05937438249397b883ca77a. That commit made the situation better for repositories with relatively small number of objects. However with many objects and a small pack size limit, the time required to complete the repack tends towards O(n^2), or even much worse with long delta chains. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index dcfe62aa02..e1d3adf405 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -445,13 +445,9 @@ static int write_one(struct sha1file *f,
if (e->idx.offset || e->preferred_base)
return -1;
- /*
- * If we are deltified, attempt to write out base object first.
- * If that fails due to the pack size limit then the current
- * object might still possibly fit undeltified within that limit.
- */
- if (e->delta)
- write_one(f, e->delta, offset);
+ /* if we are deltified, write out base object first. */
+ if (e->delta && !write_one(f, e->delta, offset))
+ return 0;
e->idx.offset = *offset;
size = write_object(f, e, *offset);
@@ -505,9 +501,11 @@ static void write_pack_file(void)
sha1write(f, &hdr, sizeof(hdr));
offset = sizeof(hdr);
nr_written = 0;
- for (i = 0; i < nr_objects; i++)
- if (write_one(f, objects + i, &offset) == 1)
- display_progress(progress_state, written);
+ for (; i < nr_objects; i++) {
+ if (!write_one(f, objects + i, &offset))
+ break;
+ display_progress(progress_state, written);
+ }
/*
* Did we write the wrong # entries in the header?
@@ -582,7 +580,7 @@ static void write_pack_file(void)
written_list[j]->offset = (off_t)-1;
}
nr_remaining -= nr_written;
- } while (nr_remaining);
+ } while (nr_remaining && i < nr_objects);
free(written_list);
stop_progress(&progress_state);