aboutsummaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2007-11-30 17:22:12 -0500
committerJunio C Hamano <gitster@pobox.com>2007-11-30 15:00:31 -0800
commit67d232426b8858b31e54a9b6a5a90916690d1153 (patch)
treee22c9a837118f214ede706c44c6ef3ed766dc254 /git-cvsimport.perl
parenta6214fe06eefded4f71012043f35ad805e7dd19c (diff)
downloadgit-67d232426b8858b31e54a9b6a5a90916690d1153.tar.gz
git-67d232426b8858b31e54a9b6a5a90916690d1153.tar.xz
cvsimport: fix usage of cvsimport.module
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>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl8
1 files changed, 4 insertions, 4 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d29b547d2..d565091c3 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -108,10 +108,6 @@ sub read_repo_config {
}
}
}
- 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:";
@@ -119,6 +115,10 @@ read_repo_config($opts);
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) {