Skip to content

Commit

Permalink
git-svn: allow a local target directory to be specified for init
Browse files Browse the repository at this point in the history
	git-svn init url://to/the/repo local-repo

will create the local-repo dirrectory if doesn't exist yet and
populate it as expected.

Original patch by Luca Barbato, cleaned up and made to work for
the current version of git-svn by me (Eric Wong).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Jul 1, 2006
1 parent 560b25a commit 03e0ea8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions contrib/git-svn/git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,19 @@ sub rebuild {
}

sub init {
$SVN_URL = shift or die "SVN repository location required " .
my $url = shift or die "SVN repository location required " .
"as a command-line argument\n";
$SVN_URL =~ s!/+$!!; # strip trailing slash
$url =~ s!/+$!!; # strip trailing slash

if (my $repo_path = shift) {
unless (-d $repo_path) {
mkpath([$repo_path]);
}
$GIT_DIR = $ENV{GIT_DIR} = $repo_path . "/.git";
init_vars();
}

$SVN_URL = $url;
unless (-d $GIT_DIR) {
my @init_db = ('git-init-db');
push @init_db, "--template=$_template" if defined $_template;
Expand Down

0 comments on commit 03e0ea8

Please sign in to comment.