git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Yasushi SHOJI <yashi@atmark-techno.com>
Date
Mar 30, 2006, 17:01 UTC
Message-ID
<87d5g3yii8.wl@mail2.atmark-techno.com>
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
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
Message 1 of 1 in “git-clone: exit early if repo isn't specified”
  1. git-clone: exit early if repo isn't specifiedYasushi SHOJI, Mar 30, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.