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>
This commit is contained in:

committed by
Junio C Hamano

parent
0879aa2870
commit
7f10f7c4e4
@ -98,7 +98,8 @@ fi
|
|||||||
dir="$2"
|
dir="$2"
|
||||||
# Try using "humanish" part of source repo if user didn't specify one
|
# 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')
|
[ -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=$(
|
D=$(
|
||||||
(cd "$dir" && git-init-db && pwd)
|
(cd "$dir" && git-init-db && pwd)
|
||||||
) &&
|
) &&
|
||||||
|
Reference in New Issue
Block a user