archimport: Fix a bug I introduced in the new log parser
[git.git] / git-clone.sh
index 8e71501..699205e 100755 (executable)
@@ -9,7 +9,7 @@
 unset CDPATH
 
 usage() {
-       echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir>"
+       echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]"
        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)
 ) &&