Skip to contentSkip to conversation

git-clone: exit early if repo isn't specified

PATCH New Yasushi SHOJI 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-clone: exit early if repo isn't specified

Subject: [PATCH] git-clone: exit early if repo isn't specified

git-clone without a repo isn't useful at all. print message and get out asap.

This patch also move the variable 'local' to where other variables are initialized.

---

 git-clone.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

a222289a855194280aade24baa005de9e55667d0

git-clone.sh +8 -2
index a731d15..7b05fd9 100755
@@ -98,6 +98,7 @@ close FH;
 '
 
 quiet=
+local=no
 use_local=no
 local_shared=no
 no_checkout=
@@ -155,6 +156,13 @@ do
 	shift
 done
 
+repo="$1"
+if test -z "$repo"
+then
+    echo >&2 'you must specify a repository to clone.'
+    exit 1
+fi
+
 # --bare implies --no-checkout
 if test yes = "$bare"
 then
@@ -178,8 +186,6 @@ fi
 
 # Turn the source into an absolute path if
 # it is local
-repo="$1"
-local=no
 if base=$(get_repo_base "$repo"); then
 	repo="$base"
 	local=yes
Signature · 1 line
1.3.0.rc1.gb8abc