summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-01-05 13:30:29 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-01-05 13:30:29 -0800
commit0c30ed0cb57988378d721d817c55f74a93dffb13 (patch)
tree7e60371081112e52dda1e80f2b29228d97aaacde
parentMerge branch 'maint' (diff)
parentcvsimport: handle the parsing of uppercase config options (diff)
downloadtgif-0c30ed0cb57988378d721d817c55f74a93dffb13.tar.xz
Merge branch 'mg/cvsimport'
* mg/cvsimport: cvsimport: handle the parsing of uppercase config options cvsimport: partial whitespace cleanup
-rwxr-xr-xgit-cvsimport.perl35
-rwxr-xr-xt/t9600-cvsimport.sh7
2 files changed, 31 insertions, 11 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;
+ }
}
}
}
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 432b82e3d5..4c384ff023 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -89,7 +89,8 @@ EOF
test_expect_success PERL 'update git module' '
(cd module-git &&
- git cvsimport -a -R -z 0 module &&
+ git config cvsimport.trackRevisions true &&
+ git cvsimport -a -z 0 module &&
git merge origin
) &&
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 &&
git config cvsimport.module module &&
- git cvsimport -a -R -z0 &&
+ git config cvsimport.trackRevisions true &&
+ git cvsimport -a -z0 &&
git merge origin
) &&
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 &&
(cd import-from-wt &&
+ git config cvsimport.trackRevisions false &&
git cvsimport -a -z0 &&
echo 1 >expect &&
git log -1 --pretty=format:%s%n >actual &&