Skip to content

Commit

Permalink
contrib/git-svn: accept configuration via repo-config
Browse files Browse the repository at this point in the history
repo-config keys are any of the long option names minus the '-'
characters

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 Apr 2, 2006
1 parent bbbc8c3 commit 5390905
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions contrib/git-svn/git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@

my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);

# convert GetOpt::Long specs for use by git-repo-config
foreach my $o (keys %opts) {
my $v = $opts{$o};
my ($key) = ($o =~ /^([a-z\-]+)/);
$key =~ s/-//g;
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`);
} else {
chomp($$v = `$arg`);
$$v = 0 if $$v eq 'false';
}
}

GetOptions(%opts, 'help|H|h' => \$_help,
'version|V' => \$_version,
'id|i=s' => \$GIT_SVN) or exit 1;
Expand Down

0 comments on commit 5390905

Please sign in to comment.