Revert "git.sh: minor cleanup"

This reverts commit e63d8dd20d.
This commit is contained in:
Leah Rowe
2025-04-18 02:25:16 +01:00
parent a2898771f6
commit 8d57bf6009
+7 -4
View File
@@ -99,21 +99,24 @@ fetch_submodule()
tmpclone() tmpclone()
{ {
eval "`setvars "n" livepull repofail`" livepull="n" && [ "$repofail" = "y" ] && \
[ "$repofail" = "y" ] && livepull="y" printf "Cached clone failed; trying online.\n" 1>&2 && 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" || x_ git clone $2 "$repodir" git clone "$1" "$repodir" || 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 ] || x_ git clone "$repodir" "$3" [ $# -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" || $err "!reset $1 $2 $3 $4 $5"
git_am_patches "$3" "$5" git_am_patches "$3" "$5"
) || repofail="y" ) || repofail="y"