Make git-svn init accept a target dir
PATCH 1/1 Make git-svn init accept a target dir
Since I'm lazy I just hacked a bit git-svn in order to create a target dir and init it if is passed as second parameter.
git-svn init url://to/the/repo local-repo
will create the local-repo dir if doesn't exist yet and populate it as expected.
Maybe someone else could find it useful
lu
Signature · 4 lines
Luca Barbato Gentoo/linux Gentoo/PPC http://dev.gentoo.org/~lu_zero
Quoted 9 lines · Luca Barbato
Since I'm lazy I just hacked a bit git-svn in order to create a target dir and init it if is passed as second parameter.
git-svn init url://to/the/repo local-repo
will create the local-repo dir if doesn't exist yet and populate it as expected.
Maybe someone else could find it useful
Sounds useful and I'll probably accept it, but I don't see the actual patch, though...
Signature · 1 line
Eric Wong
Quoted 4 lines · Eric Wong
Sounds useful and I'll probably accept it, but I don't see the actual patch, though...
ops...
Signature · 4 lines
Luca Barbato Gentoo/linux Gentoo/PPC http://dev.gentoo.org/~lu_zero
usr/bin/git-svn.new renamed from usr/bin/git-svn +12 -1
@@ -5,7 +5,7 @@ use strict; use vars qw/ $AUTHOR $VERSION $SVN_URL $SVN_INFO $SVN_WC $SVN_UUID - $GIT_SVN_INDEX $GIT_SVN + $GIT_SVN_INDEX $GIT_SVN $REPO_PATH $GIT_DIR $REV_DIR/; $AUTHOR = 'Eric Wong <[email protected]>'; $VERSION = '1.1.0-pre';
@@ -98,6 +98,7 @@ $GIT_SVN ||= $ENV{GIT_SVN_ID} || 'git-svn'; $GIT_SVN_INDEX = "$GIT_DIR/$GIT_SVN/index"; $SVN_URL = undef; +$REPO_PATH = undef; $REV_DIR = "$GIT_DIR/$GIT_SVN/revs"; $SVN_WC = "$GIT_DIR/$GIT_SVN/tree";
@@ -227,6 +228,16 @@ sub init { $SVN_URL = shift or die "SVN repository location required " . "as a command-line argument\n"; + $REPO_PATH = shift; + + if ($REPO_PATH) { + unless (-d $REPO_PATH) { + mkpath([$REPO_PATH]); + } + $GIT_DIR=$REPO_PATH . "/.git"; + $ENV{GIT_DIR}=$GIT_DIR; + } + unless (-d $GIT_DIR) { sys('git-init-db'); }