Skip to contentSkip to conversation

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

PATCH New Eric Wong 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

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

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

---

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

2eb11880066977d65ed7e51b04c2bfa97d217752

contrib/git-svn/git-svn.perl +17 -0
index 59dd504..edfb19c 100755
@@ -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;
Signature · 1 line
1.3.0.rc1.g709a5
author
#1 lore raw

PATCH 1/1 contrib/git-svn: documentation updates

contrib/git-svn/git-svn.txt:
added git-repo-config key names for options fixed quoting of "git-svn-HEAD" in the manpage use preformatted text for examples

contrib/git-svn/Makefile:
add target to generate HTML:
http://git-svn.yhbt.net/git-svn.html

---

 contrib/git-svn/Makefile    |    3 +++
 contrib/git-svn/git-svn.txt |   41 ++++++++++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 13 deletions(-)

f8198e0b9da68024f7194067eb120bbf256a6111

contrib/git-svn/Makefile +3 -0
index a330c61..d7f1643 100644
@@ -25,6 +25,9 @@ git-svn.1 : git-svn.xml
 git-svn.xml : git-svn.txt
 	asciidoc -b docbook -d manpage \
 		-f ../../Documentation/asciidoc.conf $<
+git-svn.html : git-svn.txt
+	asciidoc -b xhtml11 -d manpage \
+		-f ../../Documentation/asciidoc.conf $<
 test:
 	cd t && $(SHELL) ./t0000-contrib-git-svn.sh
 
contrib/git-svn/git-svn.txt +28 -13

114 lines not on this page · raw message

Signature · 1 line
1.3.0.rc1.g709a5