{"thread":{"id":"473","subject":"[PATCH] Add optional destination to cg-clone.","startedAt":"2005-05-04T12:00:13Z","lastAt":"2005-05-04T12:00:13Z","messageCount":1,"participants":["Anton Altaparmakov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"2568","messageId":"Pine.LNX.4.60.0505041249520.24813@hermes-1.csi.cam.ac.uk","threadId":"473","inReplyTo":null,"subject":"[PATCH] Add optional destination to cg-clone.","fromName":"Anton Altaparmakov","fromEmail":"aia21@cam.ac.uk","sentAt":"2005-05-04T12:00:13Z","receivedAt":"2005-05-04T12:00:13Z","isPatch":true,"sender":{"key":"aia21@cam.ac.uk","avatar":null},"body":"Hi Petr,\n\nBelow is a patch to latest cogito.git which adds support for an optional \ndestination to the cg-clone command, e.g. I like to use:\n\ncd /usr/src\ncg-clone rsync://blah/linux-2.6.git\ncg-clone /usr/src/linux-2.6.git ntfs-2.6.git\n\nOf course you can instead do:\n\ncg-clone rsync://blah/linux-2.6.git /usr/src/linux-2.6.git\ncg-clone /usr/src/linux-2.6.git /usr/src/ntfs-2.6.git\n\nWithout my patch you need to do:\n\ncd /usr/src\ncg-clone rsync://blah/linux-2.6.git\nmkdir tmp.git\ncd tmp.git\ncg-clone /usr/src/linux-2.6.git\nmv linux-2.6.git ../ntfs-2.6.git\ncd ..\nrmdir tmp.git\n\nFor some strange reason I prefer my version.  (-;\n\nPlease apply. Thanks.\n\nSigned-off-by: Anton Altaparmakov <aia21@cantab.net>\n\nBest regards,\n\n\tAnton\n-- \nAnton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)\nUnix Support, Computing Service, University of Cambridge, CB2 3QH, UK\nLinux NTFS maintainer / IRC: #ntfs on irc.freenode.net\nWWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/\n\n---\n\n--- cogito.git/cg-help.old\t2005-05-04 12:35:35.000000000 +0100\n+++ cogito.git/cg-help\t2005-05-04 12:35:37.000000000 +0100\n@@ -26,7 +26,7 @@ Available commands:\n \tcg-branch-add\tBNAME SOURCE_LOC\n \tcg-branch-ls\n \tcg-cancel\n-\tcg-clone\tSOURCE_LOC\n+\tcg-clone\tSOURCE_LOC [DESTINATION]\n \tcg-commit\t[FILE]...\t< log message on stdin\n \tcg-diff\t\t[-p] [-r FROM_ID[:TO_ID]] [FILE]...\n \tcg-export\tDESTDIR [TREE_ID]\n--- cogito.git/cg-clone.old\t2005-05-03 21:33:05.000000000 +0100\n+++ cogito.git/cg-clone\t2005-05-04 12:43:04.000000000 +0100\n@@ -3,18 +3,26 @@\n # Clone a remote GIT repository.\n # Copyright (c) Petr Baudis, 2005\n #\n-# This is like cg-init, but works only for remote repositories and\n-# will create a new directory where it will do the checkout.\n+# This is like cg-init, but it will create a new directory where it will do\n+# the checkout.\n #\n-# Takes an parameter specifying location of the source repository.\n+# Takes a parameter specifying the location of the source repository and an\n+# optional second parameter specifying the destination.  If the second\n+# parameter is omitted, the basename of the source repository is used as the\n+# destination.\n \n . cg-Xlib\n \n location=$1\n-[ \"$location\" ] || die \"usage: cg-clone SOURCE_LOC\"\n+[ \"$location\" ] || die \"usage: cg-clone SOURCE_LOC [DESTINATION]\"\n location=${location%/}\n \n-dir=${location%/.git}; dir=${dir##*/}\n+destination=$2\n+if [ \"$destination\" ]; then\n+\tdir=$destination\n+else\n+\tdir=${location%/.git}; dir=${dir##*/}\n+fi\n [ -e \"$dir\" ] && die \"$dir/ already exists\"\n mkdir \"$dir\" || exit $?\n cd \"$dir\" || exit $?\n"}]}