summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-11-21 20:39:02 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-21 20:39:02 +0900
commit7fab474656cdb5517d5b627602a54776e485ddbc (patch)
tree4550c2062221ddc3f5c480c4c627d1e1ba73fc63 /builtin
parentMerge branch 'js/rebase-am-options-fix' (diff)
parentpack-objects: fix off-by-one in delta-island tree-depth computation (diff)
downloadtgif-7fab474656cdb5517d5b627602a54776e485ddbc.tar.xz
Merge branch 'cc/delta-islands'
A few issues in the implementation of "delta-islands" feature has been corrected. * cc/delta-islands: pack-objects: fix off-by-one in delta-island tree-depth computation pack-objects: zero-initialize tree_depth/layer arrays pack-objects: fix tree_depth and layer invariants
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pack-objects.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index e7ea206c08..411aefd687 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2786,9 +2786,11 @@ static void show_object(struct object *obj, const char *name, void *data)
if (use_delta_islands) {
const char *p;
- unsigned depth = 0;
+ unsigned depth;
struct object_entry *ent;
+ /* the empty string is a root tree, which is depth 0 */
+ depth = *name ? 1 : 0;
for (p = strchr(name, '/'); p; p = strchr(p + 1, '/'))
depth++;