[PATCH 1/3] 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 matth...@stdin.nl --- shallow.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/shallow.c b/shallow.c index cbe2526..8a9c96d 100644 --- a/shallow.c +++ b/shallow.c @@ -110,17 +110,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; } } } -- 1.8.3.rc1 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] upload-pack: Remove a piece of dead code
On Thu, Jul 11, 2013 at 6:25 PM, Matthijs Kooijman matth...@stdin.nl wrote: 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. True. Ack-by: me. Signed-off-by: Matthijs Kooijman matth...@stdin.nl --- shallow.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/shallow.c b/shallow.c index cbe2526..8a9c96d 100644 --- a/shallow.c +++ b/shallow.c @@ -110,17 +110,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; } } } -- 1.8.3.rc1 -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] upload-pack: Remove a piece of dead code
Duy Nguyen pclo...@gmail.com writes: On Thu, Jul 11, 2013 at 6:25 PM, Matthijs Kooijman matth...@stdin.nl wrote: 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. True. Ack-by: me. Signed-off-by: Matthijs Kooijman matth...@stdin.nl Yeah, thanks both. I tend to agree that 2 and 3 are the right change that came too late after the ship sailed X-(. --- shallow.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/shallow.c b/shallow.c index cbe2526..8a9c96d 100644 --- a/shallow.c +++ b/shallow.c @@ -110,17 +110,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; } } } -- 1.8.3.rc1 -- Duy -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html