summaryrefslogtreecommitdiff
path: root/pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-09-17 13:53:53 -0700
committerJunio C Hamano <gitster@pobox.com>2018-09-17 13:53:53 -0700
commit3ebdef2e1b4c89fd193140b36c04b41eb7f9a86d (patch)
tree8b447f11ebd9e31d6c1c1a7ac5522c0c327fb810 /pack-objects.c
parent7e794d0a3f7ad4a37541539b823d5b9afdc10ce3 (diff)
parent6a1e32d532c5948071e322cefc7052be6228adc3 (diff)
downloadgit-3ebdef2e1b4c89fd193140b36c04b41eb7f9a86d.tar.gz
Merge branch 'jk/pack-delta-reuse-with-bitmap'
When creating a thin pack, which allows objects to be made into a delta against another object that is not in the resulting pack but is known to be present on the receiving end, the code learned to take advantage of the reachability bitmap; this allows the server to send a delta against a base beyond the "boundary" commit. * jk/pack-delta-reuse-with-bitmap: pack-objects: reuse on-disk deltas for thin "have" objects pack-bitmap: save "have" bitmap from walk t/perf: add perf tests for fetches from a bitmapped server t/perf: add infrastructure for measuring sizes t/perf: factor out percent calculations t/perf: factor boilerplate out of test_perf
Diffstat (limited to 'pack-objects.c')
-rw-r--r--pack-objects.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pack-objects.c b/pack-objects.c
index d04cfa8e9f..3462858772 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -181,3 +181,22 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
return new_entry;
}
+
+void oe_set_delta_ext(struct packing_data *pdata,
+ struct object_entry *delta,
+ const unsigned char *sha1)
+{
+ struct object_entry *base;
+
+ ALLOC_GROW(pdata->ext_bases, pdata->nr_ext + 1, pdata->alloc_ext);
+ base = &pdata->ext_bases[pdata->nr_ext++];
+ memset(base, 0, sizeof(*base));
+ hashcpy(base->idx.oid.hash, sha1);
+
+ /* These flags mark that we are not part of the actual pack output. */
+ base->preferred_base = 1;
+ base->filled = 1;
+
+ delta->ext_base = 1;
+ delta->delta_idx = base - pdata->ext_bases + 1;
+}