{"thread":{"id":"4727","subject":"[PATCH] git-svn: allow a local target directory to be specified for init","startedAt":"2006-07-01T04:42:53Z","lastAt":"2006-07-01T04:42:53Z","messageCount":1,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22971","messageId":"11517289734157-git-send-email-normalperson@yhbt.net","threadId":"4727","inReplyTo":null,"subject":"[PATCH] git-svn: allow a local target directory to be specified for init","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-01T04:42:53Z","receivedAt":"2006-07-01T04:42:53Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Original patch by Luca Barbato, cleaned up and made to work for\nthe current version of git-svn by me (Eric Wong).\n\nLuca 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\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n contrib/git-svn/git-svn.perl |   14 ++++++++++++--\n 1 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex b3d3f47..1e19aa1 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -264,9 +264,19 @@ when you have upgraded your tools and ha\n }\n \n sub init {\n-\t$SVN_URL = shift or die \"SVN repository location required \" .\n+\tmy $url = shift or die \"SVN repository location required \" .\n \t\t\t\t\"as a command-line argument\\n\";\n-\t$SVN_URL =~ s!/+$!!; # strip trailing slash\n+\t$url =~ s!/+$!!; # strip trailing slash\n+\n+\tif (my $repo_path = shift) {\n+\t\tunless (-d $repo_path) {\n+\t\t\tmkpath([$repo_path]);\n+\t\t}\n+\t\t$GIT_DIR = $ENV{GIT_DIR} = $repo_path . \"/.git\";\n+\t\tinit_vars();\n+\t}\n+\n+\t$SVN_URL = $url;\n \tunless (-d $GIT_DIR) {\n \t\tmy @init_db = ('git-init-db');\n \t\tpush @init_db, \"--template=$_template\" if defined $_template;\n-- \n1.4.1.rc1.g7fe3\n"}]}