{"thread":{"id":"4701","subject":"[patch] Make git-svn init accept a target dir","startedAt":"2006-06-28T23:07:25Z","lastAt":"2006-06-29T00:41:14Z","messageCount":3,"participants":["Luca Barbato","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22759","messageId":"44A30BAD.60907@gentoo.org","threadId":"4701","inReplyTo":null,"subject":"[patch] Make git-svn init accept a target dir","fromName":"Luca Barbato","fromEmail":"lu_zero@gentoo.org","sentAt":"2006-06-28T23:07:25Z","receivedAt":"2006-06-28T23:07:25Z","isPatch":true,"sender":{"key":"lu_zero@gentoo.org","avatar":"https://gravatar.com/avatar/29ad2fe7ef1c53358431a9408ac02ccede899d70f67603601b133bee0a39549e?d=mp&s=160"},"body":"Since I'm lazy I just hacked a bit git-svn in order to create a target\ndir and init it if is passed as second parameter.\n\ngit-svn init url://to/the/repo local-repo\n\nwill create the local-repo dir if doesn't exist yet and populate it as\nexpected.\n\nMaybe someone else could find it useful\n\nlu\n\n-- \n\nLuca Barbato\n\nGentoo/linux Gentoo/PPC\nhttp://dev.gentoo.org/~lu_zero\n"},{"id":"22761","messageId":"20060629002852.GA29147@hand.yhbt.net","threadId":"4701","inReplyTo":"44A30BAD.60907@gentoo.org","subject":"Re: [patch] Make git-svn init accept a target dir","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-06-29T00:28:52Z","receivedAt":"2006-06-29T00:28:52Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Luca Barbato <lu_zero@gentoo.org> wrote:\n> Since I'm lazy I just hacked a bit git-svn in order to create a target\n> dir and init it if is passed as second parameter.\n> \n> git-svn init url://to/the/repo local-repo\n> \n> will create the local-repo dir if doesn't exist yet and populate it as\n> expected.\n> \n> Maybe someone else could find it useful\n\nSounds useful and I'll probably accept it, but I don't see the actual\npatch, though...\n\n-- \nEric Wong\n"},{"id":"22763","messageId":"44A321AA.6080703@gentoo.org","threadId":"4701","inReplyTo":"20060629002852.GA29147@hand.yhbt.net","subject":"Re: [patch] Make git-svn init accept a target dir","fromName":"Luca Barbato","fromEmail":"lu_zero@gentoo.org","sentAt":"2006-06-29T00:41:14Z","receivedAt":"2006-06-29T00:41:14Z","isPatch":true,"sender":{"key":"lu_zero@gentoo.org","avatar":"https://gravatar.com/avatar/29ad2fe7ef1c53358431a9408ac02ccede899d70f67603601b133bee0a39549e?d=mp&s=160"},"body":"Eric Wong wrote:\n\n> \n> Sounds useful and I'll probably accept it, but I don't see the actual\n> patch, though...\n> \n\nops...\n\n-- \n\nLuca Barbato\n\nGentoo/linux Gentoo/PPC\nhttp://dev.gentoo.org/~lu_zero\n\n\n\n--- /usr/bin/git-svn\t2006-06-29 00:57:26.000000000 +0200\n+++ /usr/bin/git-svn.new\t2006-06-28 03:40:11.000000000 +0200\n@@ -5,7 +5,7 @@\n use strict;\n use vars qw/\t$AUTHOR $VERSION\n \t\t$SVN_URL $SVN_INFO $SVN_WC $SVN_UUID\n-\t\t$GIT_SVN_INDEX $GIT_SVN\n+\t\t$GIT_SVN_INDEX $GIT_SVN $REPO_PATH\n \t\t$GIT_DIR $REV_DIR/;\n $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';\n $VERSION = '1.1.0-pre';\n@@ -98,6 +98,7 @@\n $GIT_SVN ||= $ENV{GIT_SVN_ID} || 'git-svn';\n $GIT_SVN_INDEX = \"$GIT_DIR/$GIT_SVN/index\";\n $SVN_URL = undef;\n+$REPO_PATH = undef;\n $REV_DIR = \"$GIT_DIR/$GIT_SVN/revs\";\n $SVN_WC = \"$GIT_DIR/$GIT_SVN/tree\";\n \n@@ -227,6 +228,16 @@\n sub init {\n \t$SVN_URL = shift or die \"SVN repository location required \" .\n \t\t\t\t\"as a command-line argument\\n\";\n+        $REPO_PATH = shift;\n+        \n+        if ($REPO_PATH) {\n+            unless (-d $REPO_PATH) {\n+                mkpath([$REPO_PATH]);\n+            }\n+            $GIT_DIR=$REPO_PATH . \"/.git\";\n+            $ENV{GIT_DIR}=$GIT_DIR;\n+        }\n+\n \tunless (-d $GIT_DIR) {\n \t\tsys('git-init-db');\n \t}\n"}]}