git.sh: fix lack of error exits on fault

a previous change made it more redundant, falling back
on old behaviour (direct downloading, not cached), but
the way it's done means that the function never returns
an error condition in practise.

this patch fixes it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit6
Leah Rowe 2024-07-18 23:09:59 +01:00
parent 64283a1fb1
commit 82bdf27072
1 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
eval `setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \
depend subfile_bkup`
depend subfile_bkup repofail`
fetch_targets()
{
@ -101,6 +101,8 @@ fetch_submodule()
tmpclone()
{
repofail="n"
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
repodir="cache/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
x_ mkdir -p "cache/repo"
@ -115,7 +117,10 @@ tmpclone()
[ $# -gt 5 ] || git clone "$repodir" "$3" || $err "!clone $repodir $3"
git -C "$3" reset --hard "$4" || $err "!reset $1 $2 $3 $4 $5"
git_am_patches "$3" "$5"
) || [ $# -gt 5 ] || tmpclone $@ retry; :
) || repofail="y"
[ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone $@ retry
[ "$repofail" = "y" ] && $err "!clone $1 $2 $3 $4 $5"; :
}
git_am_patches()