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>
---
git-clone.sh | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
applies-to: 28cfa6f299b27be02a24b6887f9b82b42c0e08cd 48b959195a979b113e51e898ac878a0fd7cfb30a
Show changes to git-clone.sh +2 −1
diff --git a/git-clone.sh b/git-clone.sh index 70cf7a2..4b98fb1 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#/*\.git$##' -e 's#.*[/:]##') -mkdir "$dir" && +[ -e "$dir" ] && $(echo "$dir already exists."; usage) +mkdir -p "$dir" && D=$( (cd "$dir" && git-init-db && pwd) ) && --- 0.99.9.GIT