aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-16 23:00:25 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-16 23:00:25 +0000
commit754c7b767a3438612570e531c7605ede08e6d358 (patch)
tree8f56c5c503ef7856690a80ec41c6c9d07a1300cf /kiss
parent9286dbd50a2f2645b8c71cb47534ff82c312266f (diff)
downloadcpt-754c7b767a3438612570e531c7605ede08e6d358.tar.gz
kiss: Do a shallow clone unless checking out a hash
FossilOrigin-Name: 31e5c01f0428e3e56d461c81760928ffc5c0f9694cf1ec500901e76f35c42709
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss14
1 files changed, 10 insertions, 4 deletions
diff --git a/kiss b/kiss
index 47c676f..aa7cfb8 100755
--- a/kiss
+++ b/kiss
@@ -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