diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-16 23:00:25 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-16 23:00:25 +0000 |
commit | 754c7b767a3438612570e531c7605ede08e6d358 (patch) | |
tree | 8f56c5c503ef7856690a80ec41c6c9d07a1300cf | |
parent | 9286dbd50a2f2645b8c71cb47534ff82c312266f (diff) | |
download | cpt-754c7b767a3438612570e531c7605ede08e6d358.tar.gz |
kiss: Do a shallow clone unless checking out a hash
FossilOrigin-Name: 31e5c01f0428e3e56d461c81760928ffc5c0f9694cf1ec500901e76f35c42709
-rwxr-xr-x | kiss | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -150,12 +150,18 @@ pkg_sources() { # This is a checksums check, skip it. [ "$2" ] && continue - repo_src=${src##git+} - mkdir -p "$mak_dir/$1/$dest" - (cd "$mak_dir/$1/$dest" && git clone "${repo_src%#*}" .) || - die "$1" "Failed to clone $src" + # Run in a subshell to keep variables local. + ( + repo_src=${src##git+} + + [ "${src##*#*}" ] && shallow=--depth=1 + + cd "$mak_dir/$1/$dest" && + git clone "${shallow:---}" "${repo_src%#*}" . + + ) || die "$1" "Failed to clone $src" # Remote source. elif [ -z "${src##*://*}" ]; then |