summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Eric Wong <normalperson@yhbt.net>2006-04-01 18:25:02 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-04-01 21:57:52 -0800
commit53909056da869eb79c2a20699794b63c8c87e7fd (patch)
treed33f7df7b52e851f00584246944d0ba0769e7758
parentrevision: --max-age alone does not need limit_list() anymore. (diff)
downloadtgif-53909056da869eb79c2a20699794b63c8c87e7fd.tar.xz
contrib/git-svn: accept configuration via repo-config
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>
-rwxr-xr-xcontrib/git-svn/git-svn.perl17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 59dd504047..edfb19c39e 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -67,6 +67,23 @@ for (my $i = 0; $i < @ARGV; $i++) {
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;