threads / patch / 3760

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

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

## tl;dr

One message between Mar 30, 2006 and Mar 30, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Yasushi SHOJI· Mar 30, 2006, 17:01 UTC · lore
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.

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
---
 git-clone.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
a222289a855194280aade24baa005de9e55667d0
Show changes to git-clone.sh +8 −2
diff --git a/git-clone.sh b/git-clone.sh
index a731d15..7b05fd9 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -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
-- 
1.3.0.rc1.gb8abc

← back to recent threads