git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] contrib/git-svn: accept configuration via repo-config
@ 2006-04-02  2:25 Eric Wong
  2006-04-02  2:25 ` [PATCH] contrib/git-svn: documentation updates Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2006-04-02  2:25 UTC (permalink / raw)
  To: junkio, git; +Cc: Eric Wong

repo-config keys are any of the long option names minus the '-'
characters

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/git-svn.perl |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

2eb11880066977d65ed7e51b04c2bfa97d217752
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 59dd504..edfb19c 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;
-- 
1.3.0.rc1.g709a5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-02  2:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-02  2:25 [PATCH] contrib/git-svn: accept configuration via repo-config Eric Wong
2006-04-02  2:25 ` [PATCH] contrib/git-svn: documentation updates Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).