File tree Expand file tree Collapse file tree
builder/image/slugbuilder/builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,10 +8,19 @@ download_buildpack() {
88 buildpack_name=$( basename $buildpack_url )
99 buildpack_commit=" $2 "
1010
11- git clone $buildpack_url $BUILDPACK_INSTALL_PATH /$buildpack_name
12- pushd $BUILDPACK_INSTALL_PATH /$buildpack_name 2>&1 > /dev/null
13- git checkout --quiet $buildpack_commit
14- popd 2>&1 > /dev/null
11+ set +e
12+ git clone --branch $buildpack_commit --depth 1 $buildpack_url $BUILDPACK_INSTALL_PATH /$buildpack_name
13+ SHALLOW_CLONED=$?
14+ set -e
15+ if [ $SHALLOW_CLONED -ne 0 ]; then
16+ # if the shallow clone failed partway through, clean up and try a full clone
17+ rm -rf $BUILDPACK_INSTALL_PATH /$buildpack_name
18+ git clone $buildpack_url $BUILDPACK_INSTALL_PATH /$buildpack_name
19+ pushd $BUILDPACK_INSTALL_PATH /$buildpack_name & > /dev/null
20+ git checkout --quiet $buildpack_commit
21+ popd & > /dev/null
22+ fi
23+
1524}
1625
1726mkdir -p $BUILDPACK_INSTALL_PATH
You can’t perform that action at this time.
0 commit comments