Merge branch 'sb/submodule-clone-retry'

An earlier tweak to make "submodule update" retry a failing clone
of submodules was buggy and caused segfault, which has been fixed.

* sb/submodule-clone-retry:
  submodule-helper: fix indexing in clone retry error reporting path
  git-submodule: forward exit code of git-submodule--helper more faithfully
This commit is contained in:
Junio C Hamano 2016-08-04 14:39:17 -07:00
commit 1e9a4856fb
2 changed files with 12 additions and 12 deletions

View file

@ -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);

View file

@ -49,7 +49,7 @@ die_if_unmatched ()
{
if test "$1" = "#unmatched"
then
exit 1
exit ${2:-1}
fi
}
@ -312,11 +312,11 @@ cmd_foreach()
{
git submodule--helper list --prefix "$wt_prefix" ||
echo "#unmatched"
echo "#unmatched" $?
} |
while read mode sha1 stage sm_path
do
die_if_unmatched "$mode"
die_if_unmatched "$mode" "$sha1"
if test -e "$sm_path"/.git
then
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
@ -421,11 +421,11 @@ cmd_deinit()
{
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched"
echo "#unmatched" $?
} |
while read mode sha1 stage sm_path
do
die_if_unmatched "$mode"
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
displaypath=$(git submodule--helper relative-path "$sm_path" "$wt_prefix")
@ -579,12 +579,12 @@ cmd_update()
${depth:+--depth "$depth"} \
${recommend_shallow:+"$recommend_shallow"} \
${jobs:+$jobs} \
"$@" || echo "#unmatched"
"$@" || echo "#unmatched" $?
} | {
err=
while read mode sha1 stage just_cloned sm_path
do
die_if_unmatched "$mode"
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
url=$(git config submodule."$name".url)
@ -992,11 +992,11 @@ cmd_status()
{
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched"
echo "#unmatched" $?
} |
while read mode sha1 stage sm_path
do
die_if_unmatched "$mode"
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
url=$(git config submodule."$name".url)
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
@ -1073,11 +1073,11 @@ cmd_sync()
cd_to_toplevel
{
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched"
echo "#unmatched" $?
} |
while read mode sha1 stage sm_path
do
die_if_unmatched "$mode"
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path")
url=$(git config -f .gitmodules --get submodule."$name".url)