From 754c7b767a3438612570e531c7605ede08e6d358 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Thu, 16 Jan 2020 23:00:25 +0000 Subject: kiss: Do a shallow clone unless checking out a hash FossilOrigin-Name: 31e5c01f0428e3e56d461c81760928ffc5c0f9694cf1ec500901e76f35c42709 --- kiss | 14 ++++++++++---- 1 file 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 -- cgit v1.2.3