Skip to content

Commit ba8e7ab

Browse files
Merge pull request #6 from codefresh-io/SAAS-3397
support spare checkout
2 parents 55624f5 + 6091f63 commit ba8e7ab

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

start.sh

100755100644
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,25 @@ if [ -d "$CLONE_DIR" ]; then
9696
fi
9797
else
9898

99-
# Clone a fresh copy
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
109+
# Clone a fresh copy
100110
echo "cloning $REPO"
101111
git_retry git clone $REPO $CLONE_DIR
102112
cd $CLONE_DIR
103113

104114
if [ -n "$REVISION" ]; then
105115
git checkout $REVISION
106116
fi
117+
118+
fi
119+
107120
fi

0 commit comments

Comments
 (0)