summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
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 d5d91eeed5..3d70ab1f42 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2709,9 +2709,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++;