summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-12 23:03:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-11-12 23:03:57 (GMT)
commit6cd3729eae8d8945c0482423149163d40afd082c (patch)
tree5a41d37b2d0c5f1ba62ebb6d42901ffe4b26a796 /builtin-pack-objects.c
parent2baf1850ceb01dfbee862e30f2a69cf6064e13eb (diff)
parentc14639f7b14d3d856c7c1f6c097dd1cb9615a5d0 (diff)
downloadgit-6cd3729eae8d8945c0482423149163d40afd082c.zip
git-6cd3729eae8d8945c0482423149163d40afd082c.tar.gz
git-6cd3729eae8d8945c0482423149163d40afd082c.tar.bz2
Merge branch 'maint'
* maint: Start 1.6.0.5 cycle Fix pack.packSizeLimit and --max-pack-size handling checkout: Fix "initial checkout" detection Remove the period after the git-check-attr summary Conflicts: RelNotes
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 15b80db..95e6faf 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -245,8 +245,16 @@ static unsigned long write_object(struct sha1file *f,
type = entry->type;
/* write limit if limited packsize and not first object */
- limit = pack_size_limit && nr_written ?
- pack_size_limit - write_offset : 0;
+ if (!pack_size_limit || !nr_written)
+ limit = 0;
+ else if (pack_size_limit <= write_offset)
+ /*
+ * the earlier object did not fit the limit; avoid
+ * mistaking this with unlimited (i.e. limit = 0).
+ */
+ limit = 1;
+ else
+ limit = pack_size_limit - write_offset;
if (!entry->delta)
usable_delta = 0; /* no delta */