submodule-helper: fix indexing in clone retry error reporting path
commiteb09121b745e9aa5bbd3fa438f873c3511f48b33
authorJohannes Sixt <j6t@kdbg.org>
Fri, 22 Jul 2016 19:15:39 +0000 (22 21:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jul 2016 20:43:53 +0000 (22 13:43 -0700)
tree55b8d609ebb7d3fd505cb34a3933447a15e29f16
parentc4c02bf16c47f8751958458e540269ec13f4bd98
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 <j6t@kdbg.org>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t5815-submodule-protos.sh
t/t7400-submodule-basic.sh