kiss: Do a shallow clone unless checking out a hash

This commit is contained in:
Dylan Araps 2020-01-17 01:00:26 +02:00
parent 632d3cf721
commit 445ba5ead5
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

14
kiss
View File

@ -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