fetch: fix check for local ref path

This is a fast case if the slave has a local checkout available so that
it doesn't have to do a full clone. The check unfortunately didn't take
into account all cases and failed on the new slave.

(cherry picked from commit d867f3d470)
This commit is contained in:
Doug Goldstein
2016-12-30 10:23:25 -06:00
parent dd82264588
commit 02db49040f

View File

@@ -40,11 +40,11 @@ update_repo() {
git fetch origin || die "unable to fetch ${uri}"
else
echo "Cloning '${path}'"
if [ -z "${GIT_LOCAL_REF_DIR}" ]; then
git clone ${uri} ${path} || die "unable to clone ${uri}"
else
if [ -d "${GIT_LOCAL_REF_DIR}" ]; then
git clone --reference ${GIT_LOCAL_REF_DIR}/`basename ${path}` \
${uri} ${path} || die "unable to clone ${uri}"
${uri} ${path} || die "unable to clone ${uri}"
else
git clone ${uri} ${path} || die "unable to clone ${uri}"
fi
pushd ${path} > /dev/null
fi