提交 53909056 编写于 作者: E Eric Wong 提交者: Junio C Hamano

contrib/git-svn: accept configuration via repo-config

repo-config keys are any of the long option names minus the '-'
characters
Signed-off-by: NEric Wong <normalperson@yhbt.net>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 bbbc8c3a
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册