Skip to content

Commit c891cc9

Browse files
fix spare clone
1 parent 6091f63 commit c891cc9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

start.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ cd $WORKING_DIRECTORY
4646
git config --global advice.detachedhead false
4747
git config --global credential.helper "/bin/sh -c 'echo username=$USERNAME; echo password=$PASSWORD'"
4848

49+
if [ -n "$SPARE_CHECKOUT" ]; then
50+
echo "spare checkout"
51+
git init $CLONE_DIR
52+
chmod -R 774 $CLONE_DIR
53+
cd $CLONE_DIR
54+
git remote add origin $REPO
55+
git config core.sparsecheckout true
56+
echo "$SOURCE/*" >> .git/info/sparse-checkout
57+
git pull --depth=1 origin $REVISION
58+
exit 0
59+
fi
60+
4961
# Check if the cloned dir already exists from previous builds
5062
if [ -d "$CLONE_DIR" ]; then
5163

@@ -96,16 +108,6 @@ if [ -d "$CLONE_DIR" ]; then
96108
fi
97109
else
98110

99-
if [ -n "$SPARE_CHECKOUT" ]; then
100-
echo "spare checkout"
101-
git init $CLONE_DIR
102-
chmod -R 774 $CLONE_DIR
103-
cd $CLONE_DIR
104-
git remote add origin $REPO
105-
git config core.sparsecheckout true
106-
echo "$SOURCE/*" >> .git/info/sparse-checkout
107-
git pull --depth=1 origin $REVISION
108-
else
109111
# Clone a fresh copy
110112
echo "cloning $REPO"
111113
git_retry git clone $REPO $CLONE_DIR
@@ -115,6 +117,4 @@ else
115117
git checkout $REVISION
116118
fi
117119

118-
fi
119-
120120
fi

0 commit comments

Comments
 (0)