summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-08 21:36:37 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-08 21:36:37 +0100
commit6bdb15fd329e1ffb22ff37c7e9a296cca633f836 (patch)
tree342efc1a11daf68583895c860a0aa234d46b5180 /include
parent93d4eca04ae9b7eabb4fa72d96784b9ba714d384 (diff)
git.sh: hard fail if git am fails
similar to the last patch, we must ensure that the inability to patch will cause a hard exit, regardless of any redundancy we have for cloning. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
-rw-r--r--include/git.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/git.sh b/include/git.sh
index 3e885c1b..afcfee93 100644
--- a/include/git.sh
+++ b/include/git.sh
@@ -94,6 +94,7 @@ tmpclone()
resetfail="n"
repofail="n"
+ amfail="n"
[ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)"
repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
@@ -109,11 +110,12 @@ tmpclone()
(
[ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3"
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
+ [ "$resetfail" = "y" ] || ( fx_ "eval x_ git -C \"$3\" am" find "$5" \
+ -type f ) || amfail="y"
) || repofail="y"
[ "$resetfail" = "y" ] && err "Cannot reset revisions"
+ [ "$amfail" = "y" ] && err "Cannot apply patches"
[ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry
[ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; :