Merge branch 'mg/cvsimport'

* mg/cvsimport:
  cvsimport: handle the parsing of uppercase config options
  cvsimport: partial whitespace cleanup
This commit is contained in:
Junio C Hamano 2011-01-05 13:30:29 -08:00
commit 0c30ed0cb5
2 changed files with 30 additions and 10 deletions

View File

@ -90,6 +90,14 @@ sub write_author_info($) {
} }
# convert getopts specs for use by git config # 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 { sub read_repo_config {
# Split the string between characters, unless there is a ':' # Split the string between characters, unless there is a ':'
# So "abc:de" becomes ["a", "b", "c:", "d", "e"] # So "abc:de" becomes ["a", "b", "c:", "d", "e"]
@ -99,8 +107,17 @@ sub read_repo_config {
$key =~ s/://g; $key =~ s/://g;
my $arg = 'git config'; my $arg = 'git config';
$arg .= ' --bool' if ($o !~ /:$/); $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')) { if ($tmp && !($arg =~ /--bool/ && $tmp eq 'false')) {
no strict 'refs'; no strict 'refs';
my $opt_name = "opt_" . $key; my $opt_name = "opt_" . $key;

View File

@ -89,7 +89,8 @@ EOF
test_expect_success PERL 'update git module' ' test_expect_success PERL 'update git module' '
(cd module-git && (cd module-git &&
git cvsimport -a -R -z 0 module && git config cvsimport.trackRevisions true &&
git cvsimport -a -z 0 module &&
git merge origin git merge origin
) && ) &&
test_cmp module-cvs/o_fortuna module-git/o_fortuna test_cmp module-cvs/o_fortuna module-git/o_fortuna
@ -117,7 +118,8 @@ test_expect_success PERL 'cvsimport.module config works' '
(cd module-git && (cd module-git &&
git config cvsimport.module module && git config cvsimport.module module &&
git cvsimport -a -R -z0 && git config cvsimport.trackRevisions true &&
git cvsimport -a -z0 &&
git merge origin git merge origin
) && ) &&
test_cmp module-cvs/tick module-git/tick test_cmp module-cvs/tick module-git/tick
@ -137,6 +139,7 @@ test_expect_success PERL 'import from a CVS working tree' '
$CVS co -d import-from-wt module && $CVS co -d import-from-wt module &&
(cd import-from-wt && (cd import-from-wt &&
git config cvsimport.trackRevisions false &&
git cvsimport -a -z0 && git cvsimport -a -z0 &&
echo 1 >expect && echo 1 >expect &&
git log -1 --pretty=format:%s%n >actual && git log -1 --pretty=format:%s%n >actual &&