From bc60be10d03b95fb9f8e7e27f5eaca1310625e68 Mon Sep 17 00:00:00 2001 From: BytesGalore Date: Wed, 4 Jan 2017 17:10:48 +0100 Subject: [PATCH] git-cache: consider if git_cache dir is present --- dist/tools/git/git-cache | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/tools/git/git-cache b/dist/tools/git/git-cache index f8764895bc..6dc5f3e23a 100755 --- a/dist/tools/git/git-cache +++ b/dist/tools/git/git-cache @@ -72,7 +72,11 @@ drop() { } _check_commit() { - git_cache cat-file -e ${1}^{commit} + if [ -d "${GIT_CACHE_DIR}" ]; then + git_cache cat-file -e ${1}^{commit} + else + false + fi } _remote_name() { @@ -98,7 +102,7 @@ clone() { git_cache tag commit$SHA1 $SHA1 || true # ignore possibly already existing tag git clone --reference "${GIT_CACHE_DIR}" "${GIT_CACHE_DIR}" "${TARGET_PATH}" --branch commit$SHA1 else - git clone --reference "${GIT_CACHE_DIR}" "${REMOTE}" "${TARGET_PATH}" + git clone "${REMOTE}" "${TARGET_PATH}" git -C "${TARGET_PATH}" checkout $SHA1 fi set +e