summary refs log tree commit diff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-01-05 13:30:29 -0800
committerJunio C Hamano <gitster@pobox.com>2011-01-05 13:30:29 -0800
commit0c30ed0cb57988378d721d817c55f74a93dffb13 (patch)
tree7e60371081112e52dda1e80f2b29228d97aaacde /git-cvsimport.perl
parentf2665ec9fa42b75d92d0301cff85362836c5729a (diff)
parent60d5985dab5d3c5a283f060414b903778adfd09a (diff)
Merge branch 'mg/cvsimport'
* mg/cvsimport:
  cvsimport: handle the parsing of uppercase config options
  cvsimport: partial whitespace cleanup
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl35
1 files changed, 26 insertions, 9 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d27abfe7f3..8e683e5478 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -90,23 +90,40 @@ sub write_author_info($) {
 }
 
 # convert getopts specs for use by git config
+my %longmap = (
+	'A:' => 'authors-file',
+	'M:' => 'merge-regex',
+	'P:' => undef,
+	'R' => 'track-revisions',
+	'S:' => 'ignore-paths',
+);
+
 sub read_repo_config {
-    # Split the string between characters, unless there is a ':'
-    # So "abc:de" becomes ["a", "b", "c:", "d", "e"]
+	# Split the string between characters, unless there is a ':'
+	# So "abc:de" becomes ["a", "b", "c:", "d", "e"]
 	my @opts = split(/ *(?!:)/, shift);
 	foreach my $o (@opts) {
 		my $key = $o;
 		$key =~ s/://g;
 		my $arg = 'git config';
 		$arg .= ' --bool' if ($o !~ /:$/);
-
-        chomp(my $tmp = `$arg --get cvsimport.$key`);
+		my $ckey = $key;
+
+		if (exists $longmap{$o}) {
+			# An uppercase option like -R cannot be
+			# expressed in the configuration, as the
+			# variable names are downcased.
+			$ckey = $longmap{$o};
+			next if (! defined $ckey);
+			$ckey =~ s/-//g;
+		}
+		chomp(my $tmp = `$arg --get cvsimport.$ckey`);
 		if ($tmp && !($arg =~ /--bool/ && $tmp eq 'false')) {
-            no strict 'refs';
-            my $opt_name = "opt_" . $key;
-            if (!$$opt_name) {
-                $$opt_name = $tmp;
-            }
+			no strict 'refs';
+			my $opt_name = "opt_" . $key;
+			if (!$$opt_name) {
+				$$opt_name = $tmp;
+			}
 		}
 	}
 }