Skip to content

Commit

Permalink
upload-pack: remove a piece of dead code
Browse files Browse the repository at this point in the history
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 <matthijs@stdin.nl>
Acked-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matthijs Kooijman authored and Junio C Hamano committed Jul 15, 2013
1 parent 2532d89 commit 4b79695
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions shallow.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,12 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
continue;
*pointer = cur_depth;
}
if (cur_depth < depth) {
if (p->next)
add_object_array(&p->item->object,
NULL, &stack);
else {
commit = p->item;
cur_depth = *(int *)commit->util;
}
} else {
commit_list_insert(p->item, &result);
p->item->object.flags |= shallow_flag;
if (p->next)
add_object_array(&p->item->object,
NULL, &stack);
else {
commit = p->item;
cur_depth = *(int *)commit->util;
}
}
}
Expand Down

0 comments on commit 4b79695

Please sign in to comment.