Skip to content

Commit 4b79695

Browse files
matthijskooijmangitster
authored andcommitted
upload-pack: remove a piece of dead code
Commit 682c7d2 (upload-pack: fix off-by-one depth calculation in shallow clone) introduced a new check in get_shallow_commits to decide when to stop traversing the history and mark the current commit as a shallow root. With this new check in place, the old check can no longer be true, since the first check always fires first. This commit removes that check, making the code a bit more simple again. Signed-off-by: Matthijs Kooijman <[email protected]> Acked-by: Duy Nguyen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2532d89 commit 4b79695

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

shallow.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,12 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
9191
continue;
9292
*pointer = cur_depth;
9393
}
94-
if (cur_depth < depth) {
95-
if (p->next)
96-
add_object_array(&p->item->object,
97-
NULL, &stack);
98-
else {
99-
commit = p->item;
100-
cur_depth = *(int *)commit->util;
101-
}
102-
} else {
103-
commit_list_insert(p->item, &result);
104-
p->item->object.flags |= shallow_flag;
94+
if (p->next)
95+
add_object_array(&p->item->object,
96+
NULL, &stack);
97+
else {
98+
commit = p->item;
99+
cur_depth = *(int *)commit->util;
105100
}
106101
}
107102
}

0 commit comments

Comments
 (0)