From 0fae62228c817ff60536eef5f975516bdccd58fa Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 12 May 2020 13:52:27 +0300 Subject: [PATCH] Feat(sparse-clone): Validate parameters --- sparse-clone | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sparse-clone b/sparse-clone index 5bbaa6b..0037a86 100755 --- a/sparse-clone +++ b/sparse-clone @@ -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 -- 2.39.5