From eb09121b745e9aa5bbd3fa438f873c3511f48b33 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 22 Jul 2016 21:15:39 +0200 Subject: submodule-helper: fix indexing in clone retry error reporting path 'git submodule--helper update-clone' has logic to retry failed clones a second time. For this purpose, there is a list of submodules to clone, and a second list that is filled with the submodules to retry. Within these lists, the submodules are identified by an index as if both lists were just appended. This works nicely except when the second clone attempt fails as well. To report an error, the identifying index must be adjusted by an offset so that it can be used as an index into the second list. However, the calculation uses the logical total length of the lists so that the result always points one past the end of the second list. Pick the correct index. Signed-off-by: Johannes Sixt Acked-by: Stefan Beller Signed-off-by: Junio C Hamano --- builtin/submodule--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index b22352b6e1..6f6d67a469 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -795,7 +795,7 @@ static int update_clone_task_finished(int result, suc->failed_clones[suc->failed_clones_nr++] = ce; return 0; } else { - idx = suc->current - suc->list.nr; + idx -= suc->list.nr; ce = suc->failed_clones[idx]; strbuf_addf(err, _("Failed to clone '%s' a second time, aborting"), ce->name); -- cgit v1.2.3