summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-07-11 13:25:52 +0200
committerJunio C Hamano <gitster@pobox.com>2013-07-15 10:49:42 -0700
commit4b796951ffca7c0aa9e05d62d6d16a3c689b7f25 (patch)
tree3ed9fdedd170b50f828953a42df5ac51929fdd8e
parent2532d891a4aab003a5ce19f04509fd8549754485 (diff)
downloadgit-mk/upload-pack-off-by-one-dead-code-removal.tar.gz
upload-pack: remove a piece of dead codemk/upload-pack-off-by-one-dead-code-removal
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>
-rw-r--r--shallow.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/shallow.c b/shallow.c
index 6be915f38f..04712ac25e 100644
--- a/shallow.c
+++ b/shallow.c
@@ -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;
}
}
}