From: Junio C Hamano Date: Wed, 5 Jan 2011 21:30:29 +0000 (-0800) Subject: Merge branch 'mg/cvsimport' X-Git-Tag: v1.7.4-rc1~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0c30ed0cb57988378d721d817c55f74a93dffb13?ds=inline;hp=-c Merge branch 'mg/cvsimport' * mg/cvsimport: cvsimport: handle the parsing of uppercase config options cvsimport: partial whitespace cleanup --- 0c30ed0cb57988378d721d817c55f74a93dffb13 diff --combined git-cvsimport.perl index d27abfe7f3,58f5b11dc2..8e683e5478 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@@ -1,4 -1,4 +1,4 @@@ -#!/usr/bin/perl -w +#!/usr/bin/perl # This tool is copyright (c) 2005, Matthias Urlichs. # It is released under the Gnu Public License, version 2. @@@ -13,7 -13,6 +13,7 @@@ # The head revision is on branch "origin" by default. # You can change that with the '-o' option. +use 5.008; use strict; use warnings; use Getopt::Long; @@@ -90,23 -89,40 +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 !~ /:$/); + my $ckey = $key; - chomp(my $tmp = `$arg --get cvsimport.$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; + } } } }