Skip to content

Commit 0cd9c37

Browse files
authored
Merge pull request #4 from martin-g/shallow-git-clone
Make git-clone faster by fetching only the last commit of SU2 and the submodules
2 parents e87b84a + 781a98a commit 0cd9c37

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

build/compileSU2.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ if [ ! -z "$branch" ]; then
4444
mkdir "src"
4545
fi
4646
cd "src"
47-
git clone --recursive https://github.com/su2code/SU2 $name
47+
if [ -d $name ]; then
48+
# Remove any previous local repo. For non-ephemeral self-hosted runners
49+
rm -rf $name
50+
fi
51+
# Clone only the latest commit, without the Git history. It is much faster this way.
52+
git clone --recursive --depth=1 --shallow-submodules https://github.com/su2code/SU2 $name
4853
cd $name
4954
git config --add remote.origin.fetch '+refs/pull/*/merge:refs/remotes/origin/refs/pull/*/merge'
5055
git config --add remote.origin.fetch '+refs/heads/*:refs/remotes/origin/refs/heads/*'

0 commit comments

Comments
 (0)