Skip to content

Commit 7f10f7c

Browse files
Andreas EricssonJunio C Hamano
authored andcommitted
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>
1 parent 0879aa2 commit 7f10f7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git-clone.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ fi
9898
dir="$2"
9999
# Try using "humanish" part of source repo if user didn't specify one
100100
[ -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" &&
102103
D=$(
103104
(cd "$dir" && git-init-db && pwd)
104105
) &&

0 commit comments

Comments
 (0)