]> git.phdru.name Git - git-scripts.git/commitdiff
Feat(sparse-clone): Validate parameters
authorOleg Broytman <phd@phdru.name>
Tue, 12 May 2020 10:52:27 +0000 (13:52 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 12 May 2020 10:53:31 +0000 (13:53 +0300)
sparse-clone

index 5bbaa6b982ec2f9af1c2a31b60d7a46e96449439..0037a861eeb8d646aad477a229fb72bc86ab84da 100755 (executable)
@@ -2,15 +2,20 @@
 # Adapted from https://stackoverflow.com/a/13738951/7976758
 set -e
 
-rurl="$1"
-localdir="$2"
+if [ -z "$3" ]; then
+   echo "Usage: $0 origin local patterns..." >&2
+   exit 1
+fi
+
+origin="$1"
+local_repo="$2"
 shift 2
 
-mkdir -p "$localdir"
-cd "$localdir"
+mkdir -p "$local_repo"
+cd "$local_repo"
 
 git init
-git remote add origin "$rurl"
+git remote add origin "$origin"
 
 git config core.sparseCheckout true