git.sh: minor cleanup

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-04-18 01:52:44 +01:00
parent 11078508a2
commit e63d8dd20d
+4 -7
View File
@@ -99,24 +99,21 @@ fetch_submodule()
tmpclone() tmpclone()
{ {
livepull="n" && [ "$repofail" = "y" ] && \ eval "`setvars "n" livepull repofail`"
printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" [ "$repofail" = "y" ] && livepull="y"
repofail="n"
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)" [ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo" mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo"
if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then
git clone "$1" "$repodir" || git clone $2 "$repodir" || \ git clone "$1" "$repodir" || x_ git clone $2 "$repodir"
$err "!clone $1 $2 $repodir $4 $5" #
elif [ -d "$repodir" ] && [ $# -lt 6 ]; then elif [ -d "$repodir" ] && [ $# -lt 6 ]; then
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \ git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
|| sleep 3 || git -C "$repodir" pull || : || sleep 3 || git -C "$repodir" pull || :
fi fi
( (
[ $# -gt 5 ] || git clone "$repodir" "$3" || $err "!clone $repodir $3" [ $# -gt 5 ] || x_ git clone "$repodir" "$3"
git -C "$3" reset --hard "$4" || $err "!reset $1 $2 $3 $4 $5" git -C "$3" reset --hard "$4" || $err "!reset $1 $2 $3 $4 $5"
git_am_patches "$3" "$5" git_am_patches "$3" "$5"
) || repofail="y" ) || repofail="y"