From 93d4eca04ae9b7eabb4fa72d96784b9ba714d384 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 21:33:17 +0100 Subject: 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 --- include/git.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/git.sh') 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"; : } -- cgit v1.2.1