aboutsummaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2008-08-12 11:31:06 -0700
committerJunio C Hamano <gitster@pobox.com>2008-08-12 15:39:46 -0700
commit6d6f9cddbe419710a36e778a50a7712ac4ba016f (patch)
treea84b6a06ad9d249cf2148deade4b09cee5b07366 /builtin-pack-objects.c
parent04c6e9e9ca34226db095bbaa1218030f99f0b7c6 (diff)
downloadgit-6d6f9cddbe419710a36e778a50a7712ac4ba016f.tar.gz
git-6d6f9cddbe419710a36e778a50a7712ac4ba016f.tar.xz
pack-objects: Allow missing base objects when creating thin packs
If we are building a thin pack and one of the base objects we would consider for deltification is missing its OK, the other side already has that base object. We may be able to get a delta from another object, or we can simply send the new object whole (no delta). This change allows a shallow clone to store only the objects which are unique to it, as well as the boundary commit and its trees, but avoids storing the boundary blobs. This special form of a shallow clone is able to represent just the difference between two trees. Pack objects change suggested by Nicolas Pitre. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Acked-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 2dadec163..b43e0b8f2 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1096,9 +1096,12 @@ static void check_object(struct object_entry *entry)
}
entry->type = sha1_object_info(entry->idx.sha1, &entry->size);
- if (entry->type < 0)
- die("unable to get type of object %s",
- sha1_to_hex(entry->idx.sha1));
+ /*
+ * The error condition is checked in prepare_pack(). This is
+ * to permit a missing preferred base object to be ignored
+ * as a preferred base. Doing so can result in a larger
+ * pack file, but the transfer will still take place.
+ */
}
static int pack_offset_sort(const void *_a, const void *_b)
@@ -1722,8 +1725,12 @@ static void prepare_pack(int window, int depth)
if (entry->no_try_delta)
continue;
- if (!entry->preferred_base)
+ if (!entry->preferred_base) {
nr_deltas++;
+ if (entry->type < 0)
+ die("unable to get type of object %s",
+ sha1_to_hex(entry->idx.sha1));
+ }
delta_list[n++] = entry;
}