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

[PATCH] Make cg-clone handle local directories as sources

From
RARyan Anderson <ryan@michonline.com>
Date
Apr 29, 2005, 21:59 UTC
Message-ID
<20050429215928.GF1233@mythryan2.michonline.com>

cg-clone is described as only being used with remote repositories, but it has the nice feature of creating the destination directory for you.

This patch adds two features:
	1. A destination directory can (optionally) be specified.
	2. The source directory can be in the local file system.
The following, for example, now works:
	cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
	mkdir test ; cd test
	cg-clone ../cogito ../cogito2/
Index: cg-clone
===================================================================
--- c3aa1e6b53cc59d5fbe261f3f859584904ae3a63/cg-clone  (mode:100755 sha1:4ee0685c358e094c5350b3968d013105da6ddf7e)
+++ uncommitted/cg-clone  (mode:100755)
@@ -11,13 +11,22 @@
 . cg-Xlib
 
 location=$1
-[ "$location" ] || die "usage: cg-clone SOURCE_LOC"
+[ "$location" ] || die "usage: cg-clone SOURCE_LOC [DEST_LOC]"
 location=${location%/}
 
-dir=${location##*/}; dir=${dir%.git}
+if [ "$2" == "" ]; then
+	dir=${location##*/}; dir=${dir%.git}
+else
+	dir=$2
+fi
+
+pwd=$(pwd)
+relative_location=$(echo "$location" | sed -e "s#^[^/]#$pwd\/&#")
+
 [ -e "$dir" ] && die "$dir/ already exists"
 mkdir "$dir"
 cd "$dir"
 
-cg-init $location || exit $?
+echo "cg-init $relative_location"
+cg-init $relative_location || exit $?
 echo "Cloned to $dir/ (origin $location available as branch \"origin\")"
-- 
Ryan Anderson
  sometimes Pug Majere
Next: Ryan Anderson
Message 1 of 3 in “Make cg-clone handle local directories as sources”
  1. Make cg-clone handle local directories as sourcesRyan Anderson, Apr 29, 2005
  2. Ryan AndersonApr 29, 2005
  3. Ryan AndersonApr 29, 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.