Hi Petr,
Below is a patch to latest cogito.git which adds support for an optional destination to the cg-clone command, e.g. I like to use:
cd /usr/src cg-clone rsync://blah/linux-2.6.git cg-clone /usr/src/linux-2.6.git ntfs-2.6.git
Of course you can instead do:
cg-clone rsync://blah/linux-2.6.git /usr/src/linux-2.6.git cg-clone /usr/src/linux-2.6.git /usr/src/ntfs-2.6.git
Without my patch you need to do:
cd /usr/src cg-clone rsync://blah/linux-2.6.git mkdir tmp.git cd tmp.git cg-clone /usr/src/linux-2.6.git mv linux-2.6.git ../ntfs-2.6.git cd .. rmdir tmp.git
For some strange reason I prefer my version. (-;
Please apply. Thanks.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
---
--- cogito.git/cg-help.old 2005-05-04 12:35:35.000000000 +0100
+++ cogito.git/cg-help 2005-05-04 12:35:37.000000000 +0100
@@ -26,7 +26,7 @@ Available commands:
cg-branch-add BNAME SOURCE_LOC
cg-branch-ls
cg-cancel
- cg-clone SOURCE_LOC
+ cg-clone SOURCE_LOC [DESTINATION]
cg-commit [FILE]... < log message on stdin
cg-diff [-p] [-r FROM_ID[:TO_ID]] [FILE]...
cg-export DESTDIR [TREE_ID]
--- cogito.git/cg-clone.old 2005-05-03 21:33:05.000000000 +0100
+++ cogito.git/cg-clone 2005-05-04 12:43:04.000000000 +0100
@@ -3,18 +3,26 @@
# Clone a remote GIT repository.
# Copyright (c) Petr Baudis, 2005
#
-# This is like cg-init, but works only for remote repositories and
-# will create a new directory where it will do the checkout.
+# This is like cg-init, but it will create a new directory where it will do
+# the checkout.
#
-# Takes an parameter specifying location of the source repository.
+# Takes a parameter specifying the location of the source repository and an
+# optional second parameter specifying the destination. If the second
+# parameter is omitted, the basename of the source repository is used as the
+# destination.
. cg-Xlib
location=$1
-[ "$location" ] || die "usage: cg-clone SOURCE_LOC"
+[ "$location" ] || die "usage: cg-clone SOURCE_LOC [DESTINATION]"
location=${location%/}
-dir=${location%/.git}; dir=${dir##*/}
+destination=$2
+if [ "$destination" ]; then
+ dir=$destination
+else
+ dir=${location%/.git}; dir=${dir##*/}
+fi
[ -e "$dir" ] && die "$dir/ already exists"
mkdir "$dir" || exit $?
cd "$dir" || exit $?