Skip to content

Commit 0c30ed0

Browse files
committed
Merge branch 'mg/cvsimport'
* mg/cvsimport: cvsimport: handle the parsing of uppercase config options cvsimport: partial whitespace cleanup
2 parents f2665ec + 60d5985 commit 0c30ed0

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

git-cvsimport.perl

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,40 @@ ($)
9090
}
9191

9292
# convert getopts specs for use by git config
93+
my %longmap = (
94+
'A:' => 'authors-file',
95+
'M:' => 'merge-regex',
96+
'P:' => undef,
97+
'R' => 'track-revisions',
98+
'S:' => 'ignore-paths',
99+
);
100+
93101
sub read_repo_config {
94-
# Split the string between characters, unless there is a ':'
95-
# So "abc:de" becomes ["a", "b", "c:", "d", "e"]
102+
# Split the string between characters, unless there is a ':'
103+
# So "abc:de" becomes ["a", "b", "c:", "d", "e"]
96104
my @opts = split(/ *(?!:)/, shift);
97105
foreach my $o (@opts) {
98106
my $key = $o;
99107
$key =~ s/://g;
100108
my $arg = 'git config';
101109
$arg .= ' --bool' if ($o !~ /:$/);
102-
103-
chomp(my $tmp = `$arg --get cvsimport.$key`);
110+
my $ckey = $key;
111+
112+
if (exists $longmap{$o}) {
113+
# An uppercase option like -R cannot be
114+
# expressed in the configuration, as the
115+
# variable names are downcased.
116+
$ckey = $longmap{$o};
117+
next if (! defined $ckey);
118+
$ckey =~ s/-//g;
119+
}
120+
chomp(my $tmp = `$arg --get cvsimport.$ckey`);
104121
if ($tmp && !($arg =~ /--bool/ && $tmp eq 'false')) {
105-
no strict 'refs';
106-
my $opt_name = "opt_" . $key;
107-
if (!$$opt_name) {
108-
$$opt_name = $tmp;
109-
}
122+
no strict 'refs';
123+
my $opt_name = "opt_" . $key;
124+
if (!$$opt_name) {
125+
$$opt_name = $tmp;
126+
}
110127
}
111128
}
112129
}

t/t9600-cvsimport.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ EOF
8989
test_expect_success PERL 'update git module' '
9090
9191
(cd module-git &&
92-
git cvsimport -a -R -z 0 module &&
92+
git config cvsimport.trackRevisions true &&
93+
git cvsimport -a -z 0 module &&
9394
git merge origin
9495
) &&
9596
test_cmp module-cvs/o_fortuna module-git/o_fortuna
@@ -117,7 +118,8 @@ test_expect_success PERL 'cvsimport.module config works' '
117118
118119
(cd module-git &&
119120
git config cvsimport.module module &&
120-
git cvsimport -a -R -z0 &&
121+
git config cvsimport.trackRevisions true &&
122+
git cvsimport -a -z0 &&
121123
git merge origin
122124
) &&
123125
test_cmp module-cvs/tick module-git/tick
@@ -137,6 +139,7 @@ test_expect_success PERL 'import from a CVS working tree' '
137139
138140
$CVS co -d import-from-wt module &&
139141
(cd import-from-wt &&
142+
git config cvsimport.trackRevisions false &&
140143
git cvsimport -a -z0 &&
141144
echo 1 >expect &&
142145
git log -1 --pretty=format:%s%n >actual &&

0 commit comments

Comments
 (0)