diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | include/git.sh | 10 |
2 files changed, 10 insertions, 1 deletions
@@ -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" } |