git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] git-clone: Allow cloning into directories other than child of current dir.

From
Andreas Ericsson <exon@op5.se>
Date
Nov 10, 2005, 11:58 UTC
Message-ID
<20051110115808.466765BB44@nox.op5.se>

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

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
Message 1 of 1 in “git-clone: Allow cloning into directories other than child of current dir.”
  1. 2/2 git-clone: Allow cloning into directories other than child of current dir.Andreas Ericsson, Nov 10, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.