X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-clone.sh;h=823c74b9139d4a77eb5430674bf0237fb573c14c;hb=810e1523753553968aac827f57e0e24fc9af6546;hp=6887321972aab5825734dd81560f9c8cdd010660;hpb=dad7230a1c9e6d4be2cbc1596406819975588233;p=git.git diff --git a/git-clone.sh b/git-clone.sh index 68873219..823c74b9 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -9,7 +9,7 @@ unset CDPATH usage() { - echo >&2 "Usage: $0 [--use-separate-remote] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [-o ] [-n] []" + echo >&2 "Usage: $0 [--use-separate-remote] [--reference ] [--bare] [-l [-s]] [-q] [-u ] [--origin ] [-n] []" exit 1 } @@ -98,6 +98,7 @@ close FH; ' quiet= +local=no use_local=no local_shared=no no_checkout= @@ -121,14 +122,15 @@ while *,-q|*,--quiet) quiet=-q ;; *,--use-separate-remote) use_separate_remote=t ;; - 1,-o) usage;; 1,--reference) usage ;; *,--reference) shift; reference="$1" ;; *,--reference=*) reference=`expr "$1" : '--reference=\(.*\)'` ;; - *,-o) + *,-o|*,--or|*,--ori|*,--orig|*,--origi|*,--origin) case "$2" in + '') + usage ;; */*) echo >&2 "'$2' is not suitable for an origin name" exit 1 @@ -138,7 +140,7 @@ while exit 1 } test -z "$origin_override" || { - echo >&2 "Do not give more than one -o options." + echo >&2 "Do not give more than one --origin options." exit 1 } origin_override=yes @@ -155,12 +157,19 @@ 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 if test yes = "$origin_override" then - echo >&2 '--bare and -o $origin options are incompatible.' + echo >&2 '--bare and --origin $origin options are incompatible.' exit 1 fi if test t = "$use_separate_remote" @@ -178,8 +187,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