summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a6214fe)
raw | patch | inline | side by side (parent: a6214fe)
author | Jeff King <peff@peff.net> | |
Fri, 30 Nov 2007 22:22:12 +0000 (17:22 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 30 Nov 2007 23:00:31 +0000 (15:00 -0800) |
There were two problems:
1. We only look at the config variable if there is no module
given on the command line. We checked this by comparing
@ARGV == 0. However, at the time of the comparison, we
have not yet parsed the dashed options, meaning that
"git cvsimport" would read the variable but "git
cvsimport -a" would not. This is fixed by simply moving
the check after the call to getopt.
2. If the config variable did not exist, we were adding an
empty string to @ARGV. The rest of the script, rather
than barfing for insufficient input, would then try to
import the module '', leading to rather confusing error
messages. Based on patch from Emanuele Giaquinta.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1. We only look at the config variable if there is no module
given on the command line. We checked this by comparing
@ARGV == 0. However, at the time of the comparison, we
have not yet parsed the dashed options, meaning that
"git cvsimport" would read the variable but "git
cvsimport -a" would not. This is fixed by simply moving
the check after the call to getopt.
2. If the config variable did not exist, we were adding an
empty string to @ARGV. The rest of the script, rather
than barfing for insufficient input, would then try to
import the module '', leading to rather confusing error
messages. Based on patch from Emanuele Giaquinta.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-cvsimport.perl | patch | blob | history | |
t/t9600-cvsimport.sh | patch | blob | history |
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d29b547d2670eb1a3c4d3290ab10939cf652497a..d565091c35b1931035bbfdf455efec38fde51833 100755 (executable)
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
}
}
}
- if (@ARGV == 0) {
- chomp(my $module = `git-repo-config --get cvsimport.module`);
- push(@ARGV, $module);
- }
}
my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:";
getopts($opts) or usage();
usage if $opt_h;
+if (@ARGV == 0) {
+ chomp(my $module = `git-repo-config --get cvsimport.module`);
+ push(@ARGV, $module) if $? == 0;
+}
@ARGV <= 1 or usage("You can't specify more than one CVS module");
if ($opt_d) {
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 3338d447c5b7b43ac274e6966ee693611f5e8056..29fee2dd13c6826338e92bf6e61cc39b057da444 100755 (executable)
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
'
+test_expect_success 'update cvs module' '
+
+ cd module-cvs &&
+ echo 1 >tick &&
+ cvs add tick &&
+ cvs commit -m 1
+ cd ..
+
+'
+
+test_expect_success 'cvsimport.module config works' '
+
+ cd module-git &&
+ git config cvsimport.module module &&
+ git cvsimport -a -z0 &&
+ git merge origin &&
+ cd .. &&
+ git diff module-cvs/tick module-git/tick
+
+'
+
test_done