Skip to content

Commit

Permalink
git-clone: Allow cloning into directories other than child of current…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Andreas Ericsson authored and Junio C Hamano committed Nov 11, 2005
1 parent 0879aa2 commit 7f10f7c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
) &&
Expand Down

0 comments on commit 7f10f7c

Please sign in to comment.