summaryrefslogtreecommitdiff
path: root/include/git.sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/git.sh')
-rw-r--r--include/git.sh24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/git.sh b/include/git.sh
index 2eea5137..f8441f33 100644
--- a/include/git.sh
+++ b/include/git.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
eval `setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \
- depend subfile_bkup`
+ depend subfile_bkup repofail`
fetch_targets()
{
@@ -37,7 +37,7 @@ fetch_project()
clone_project()
{
- loc="cache/repo/$project" && singletree "$project" && \
+ loc="$XBMK_CACHE/repo/$project" && singletree "$project" && \
loc="src/$project"
printf "Downloading project '%s' to '%s'\n" "$project" "$loc"
@@ -62,8 +62,9 @@ git_prep()
[ "$project" = "coreboot" ] && [ -n "$xtree" ] && [ $# -gt 2 ] && \
[ "$xtree" != "$tree" ] && link_crossgcc "$_loc"
- [ "$XBMK_RELEASE" = "y" ] && [ "$_loc" != "cache/repo/$project" ] \
- && rmgit "$tmpgit"
+ [ "$XBMK_RELEASE" = "y" ] && \
+ [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \
+ rmgit "$tmpgit"
move_repo "$_loc"
}
@@ -101,12 +102,16 @@ fetch_submodule()
tmpclone()
{
+ [ "$repofail" = "y" ] && \
+ printf "Cached clone failed; trying online.\n" 1>&2
+ repofail="n"
+
[ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)"
- repodir="cache/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
- x_ mkdir -p "cache/repo"
+ repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3"
+ mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo"
if [ -d "$repodir" ] && [ $# -lt 6 ]; then
git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \
- || sleep 3 || git -C "$repodir" pull :
+ || sleep 3 || git -C "$repodir" pull || :
else
git clone $1 "$repodir" || git clone $2 "$repodir" || \
$err "!clone $1 $2 $repodir $4 $5"
@@ -115,7 +120,10 @@ tmpclone()
[ $# -gt 5 ] || git clone "$repodir" "$3" || $err "!clone $repodir $3"
git -C "$3" reset --hard "$4" || $err "!reset $1 $2 $3 $4 $5"
git_am_patches "$3" "$5"
- ) || [ $# -gt 5 ] || tmpclone $@ retry; :
+ ) || repofail="y"
+
+ [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone $@ retry
+ [ "$repofail" = "y" ] && $err "!clone $1 $2 $3 $4 $5"; :
}
git_am_patches()