X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-clone.sh;h=280cc2e81e98c5fe69e8528ca97069dd0b0e59f5;hb=9b15770220aab37302cda115d257eeb4e6e72959;hp=8e7150127aff222059f3549a8b7f647b8f792c7d;hpb=0879aa28708dcdfa255fff631781e5178755498e;p=git.git diff --git a/git-clone.sh b/git-clone.sh index 8e715012..280cc2e8 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -9,7 +9,7 @@ unset CDPATH usage() { - echo >&2 "* git clone [-l [-s]] [-q] [-u ] [-n] " + echo >&2 "Usage: $0 [-l [-s]] [-q] [-u ] [-n] []" exit 1 } @@ -73,7 +73,7 @@ while *,-n) no_checkout=yes ;; *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;; *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared) - local_shared=yes ;; + local_shared=yes; use_local=yes ;; *,-q|*,--quiet) quiet=-q ;; 1,-u|1,--upload-pack) usage ;; *,-u|*,--upload-pack) @@ -98,7 +98,8 @@ fi dir="$2" # Try using "humanish" part of source repo if user didn't specify one [ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*/||g') -mkdir "$dir" && +[ -e "$dir" ] && echo "$dir already exists." && usage +mkdir -p "$dir" && D=$( (cd "$dir" && git-init-db && pwd) ) && @@ -187,7 +188,10 @@ yes,yes) cd "$D" && case "$upload_pack" in '') git-clone-pack $quiet "$repo" ;; *) git-clone-pack $quiet "$upload_pack" "$repo" ;; - esac + esac || { + echo >&2 "clone-pack from '$repo' failed." + exit 1 + } ;; esac ;;