summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--include/git.sh10
2 files changed, 10 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index d6c27f5d..17647cbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*~
*.o
/lbmk.err.log
+/repo/
/docs/
/pciroms/
/util/dell-flash-unlock/dell_flash_unlock
diff --git a/include/git.sh b/include/git.sh
index 58f62ef3..25db40b8 100644
--- a/include/git.sh
+++ b/include/git.sh
@@ -103,7 +103,15 @@ fetch_submodule()
tmpclone()
{
- git clone $1 "$3" || git clone $2 "$3" || $err "!clone $1 $2 $3 $4 $5"
+ repodir="repo/${1##*/}"
+ x_ mkdir -p "repo"
+ if [ -d "$repodir" ]; then
+ git -C "$repodir" pull || :
+ else
+ git clone $1 "$repodir" || git clone $2 "$repodir" || \
+ $err "!clone $1 $2 $repodir $4 $5"
+ fi
+ 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"
}