From: Andreas Ericsson Date: Thu, 10 Nov 2005 11:58:08 +0000 (+0100) Subject: git-clone: Allow cloning into directories other than child of current dir. X-Git-Tag: v0.99.9h^2~23 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7f10f7c4e4943fefbc8b8310d1d1d7753f5e3aff;p=git.git git-clone: Allow cloning into directories other than child of current dir. This patch adds -p to mkdir and an explicit check to see if the target directory exists (since mkdir -p doesn't throw an error if it does). Signed-off-by: Andreas Ericsson Signed-off-by: Junio C Hamano --- diff --git a/git-clone.sh b/git-clone.sh index 8e715012..f99e0adf 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -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) ) &&