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 <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
Andreas Ericsson committed
Nov 10, 2005 at 12:58 UTC
7f10f7c4e4943fefbc8b8310d1d1d7753f5e3aff
1 file changed
+2
-1
git-clone.sh
+2
-1
@@ -98,7 +98,8 @@ fi
98
dir="$2"
99
# Try using "humanish" part of source repo if user didn't specify one
100
[ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*/||g')
101
-mkdir "$dir" &&
101
+[ -e "$dir" ] && $(echo "$dir already exists."; usage)
102
+mkdir -p "$dir" &&
103
D=$(
104
(cd "$dir" && git-init-db && pwd)
105
) &&