Skip to content

Commit

Permalink
Merge pull request metal3-io#1400 from Nordix/shallow_clone
Browse files Browse the repository at this point in the history
speed up git cloning in dev-env
  • Loading branch information
metal3-io-bot authored May 14, 2024
2 parents 053ea96 + f6945ea commit af8d176
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,17 @@ clone_repo() {
if [[ -d "${REPO_PATH}" ]] && [[ "${FORCE_REPO_UPDATE}" = "true" ]]; then
rm -rf "${REPO_PATH}"
fi
if [[ ! -d "${REPO_PATH}" ]] ; then
if [[ ! -d "${REPO_PATH}" ]]; then
pushd "${M3PATH}" || exit
git clone "${REPO_URL}" "${REPO_PATH}"
popd || exit
pushd "${REPO_PATH}" || exit
git checkout "${REPO_BRANCH}"
git checkout "${REPO_COMMIT}"
git pull -r || true
if [[ "${REPO_COMMIT}" = "HEAD" ]]; then
git clone --depth 1 --branch "${REPO_BRANCH}" "${REPO_URL}" \
"${REPO_PATH}"
else
git clone --branch "${REPO_BRANCH}" "${REPO_URL}" "${REPO_PATH}"
pushd "${REPO_PATH}" || exit
git checkout "${REPO_COMMIT}"
popd || exit
fi
popd || exit
fi
}
Expand Down

0 comments on commit af8d176

Please sign in to comment.