X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fgit-svn%2Fgit-svn.perl;h=de13a96b8a66c97fdc2e5822986ea48285fa9b6d;hb=188a634fec006a37489163b4bd36321d0a0ade77;hp=edfb19c39e969c71c270c3e14378b80780ab438f;hpb=7941602983f68e2cddafca5a2da8215d1271742b;p=git.git diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl index edfb19c3..de13a96b 100755 --- a/contrib/git-svn/git-svn.perl +++ b/contrib/git-svn/git-svn.perl @@ -8,7 +8,7 @@ use vars qw/ $AUTHOR $VERSION $GIT_SVN_INDEX $GIT_SVN $GIT_DIR $REV_DIR/; $AUTHOR = 'Eric Wong '; -$VERSION = '0.11.0'; +$VERSION = '1.0.0'; use Cwd qw/abs_path/; $GIT_DIR = abs_path($ENV{GIT_DIR} || '.git'); @@ -42,7 +42,8 @@ my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext, my %cmd = ( fetch => [ \&fetch, "Download new revisions from SVN", { 'revision|r=s' => \$_revision, %fc_opts } ], - init => [ \&init, "Initialize and fetch (import)", { } ], + init => [ \&init, "Initialize a repo for tracking" . + " (requires URL argument)", { } ], commit => [ \&commit, "Commit git revisions to SVN", { 'stdin|' => \$_stdin, 'edit|e' => \$_edit, @@ -75,12 +76,14 @@ foreach my $o (keys %opts) { my $arg = 'git-repo-config'; $arg .= ' --int' if ($o =~ /=i$/); $arg .= ' --bool' if ($o !~ /=[sfi]$/); - $arg .= " svn.$key"; # $key only matches [a-z\-], always shell-safe if (ref $v eq 'ARRAY') { - chomp(@$v = `$arg`); + chomp(my @tmp = `$arg --get-all svn.$key`); + @$v = @tmp if @tmp; } else { - chomp($$v = `$arg`); - $$v = 0 if $$v eq 'false'; + chomp(my $tmp = `$arg --get svn.$key`); + if ($tmp && !($arg =~ / --bool / && $tmp eq 'false')) { + $$v = $tmp; + } } } @@ -218,7 +221,8 @@ when you have upgraded your tools and habits to use refs/remotes/$GIT_SVN } sub init { - $SVN_URL = shift or croak "SVN repository location required\n"; + $SVN_URL = shift or die "SVN repository location required " . + "as a command-line argument\n"; unless (-d $GIT_DIR) { sys('git-init-db'); }