diff options
author | Leah Rowe <leah@libreboot.org> | 2025-05-08 21:33:17 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-05-08 21:33:17 +0100 |
commit | 93d4eca04ae9b7eabb4fa72d96784b9ba714d384 (patch) | |
tree | a7b1a3874c7c7bbb55623b1f06433a5c6fbea979 /include/git.sh | |
parent | a3ba8acface32900a524cf0ab429cadcd99577bc (diff) |
git.sh: Hard fail if reset fails
We allow a re-try when cloning fails, to account
for redundancy, but resetfail currently doesn't
cause any error exit at all.
This patch mitigates that bug.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/git.sh')
-rw-r--r-- | include/git.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/git.sh b/include/git.sh index 81c75806..3e885c1b 100644 --- a/include/git.sh +++ b/include/git.sh @@ -92,6 +92,7 @@ tmpclone() livepull="n" && [ "$repofail" = "y" ] && \ printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" + resetfail="n" repofail="n" [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" @@ -107,10 +108,13 @@ tmpclone() fi ( [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" - git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5" + git -C "$3" reset --hard "$4" || resetfail="y" + [ "$resetfail" = "y" ] && err "'$3': Cannot reset to rev '$4'" fx_ "eval x_ git -C \"$3\" am" find "$5" -type f ) || repofail="y" + [ "$resetfail" = "y" ] && err "Cannot reset revisions" + [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : } |