{"thread":{"id":"11071","subject":"[PATCH] cvsimport: fix usage of cvsimport.module","startedAt":"2007-11-30T22:22:12Z","lastAt":"2007-12-01T02:36:38Z","messageCount":2,"participants":["Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"61526","messageId":"20071130222212.GA30037@coredump.intra.peff.net","threadId":"11071","inReplyTo":null,"subject":"[PATCH] cvsimport: fix usage of cvsimport.module","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-11-30T22:22:12Z","receivedAt":"2007-11-30T22:22:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"There were two problems:\n\n  1. We only look at the config variable if there is no module\n     given on the command line. We checked this by comparing\n     @ARGV == 0. However, at the time of the comparison, we\n     have not yet parsed the dashed options, meaning that\n     \"git cvsimport\" would read the variable but \"git\n     cvsimport -a\" would not. This is fixed by simply moving\n     the check after the call to getopt.\n\n  2. If the config variable did not exist, we were adding an\n     empty string to @ARGV. The rest of the script, rather\n     than barfing for insufficient input, would then try to\n     import the module '', leading to rather confusing error\n     messages. Based on patch from Emanuele Giaquinta.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nOn Fri, Nov 30, 2007 at 08:33:04PM +0100, Emanuele Giaquinta wrote:\n\n> I found another minor bug in git-cvsimport, which the\n> attached patch fixes [...]\n\nEmanuele, thanks for submitting the patch. However, please be sure\nto copy the list (git@vger.kernel.org), and please follow\nthe format described in Documentation/SubmittingPatches.\n\nAs it turns out, while checking your patch, I found another\nserious error, so I just rolled them together.\n\n git-cvsimport.perl   |    8 ++++----\n t/t9600-cvsimport.sh |   21 +++++++++++++++++++++\n 2 files changed, 25 insertions(+), 4 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 321a27e..92648f4 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -108,10 +108,6 @@ sub read_repo_config {\n             }\n \t\t}\n \t}\n-    if (@ARGV == 0) {\n-        chomp(my $module = `git-repo-config --get cvsimport.module`);\n-        push(@ARGV, $module);\n-    }\n }\n \n my $opts = \"haivmkuo:d:p:r:C:z:s:M:P:A:S:L:\";\n@@ -119,6 +115,10 @@ read_repo_config($opts);\n getopts($opts) or usage();\n usage if $opt_h;\n \n+if (@ARGV == 0) {\n+\t\tchomp(my $module = `git-repo-config --get cvsimport.module`);\n+\t\tpush(@ARGV, $module) if $? == 0;\n+}\n @ARGV <= 1 or usage(\"You can't specify more than one CVS module\");\n \n if ($opt_d) {\ndiff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh\nindex 3338d44..29fee2d 100755\n--- a/t/t9600-cvsimport.sh\n+++ b/t/t9600-cvsimport.sh\n@@ -98,4 +98,25 @@ test_expect_success 'update git module' '\n \n '\n \n+test_expect_success 'update cvs module' '\n+\n+\tcd module-cvs &&\n+\t\techo 1 >tick &&\n+\t\tcvs add tick &&\n+\t\tcvs commit -m 1\n+\tcd ..\n+\n+'\n+\n+test_expect_success 'cvsimport.module config works' '\n+\n+\tcd module-git &&\n+\t\tgit config cvsimport.module module &&\n+\t\tgit cvsimport -a -z0 &&\n+\t\tgit merge origin &&\n+\tcd .. &&\n+\tgit diff module-cvs/tick module-git/tick\n+\n+'\n+\n test_done\n-- \n1.5.3.6.2064.g2e22f-dirty\n"},{"id":"61546","messageId":"7vabov9m4p.fsf@gitster.siamese.dyndns.org","threadId":"11071","inReplyTo":"20071130222212.GA30037@coredump.intra.peff.net","subject":"Re: [PATCH] cvsimport: fix usage of cvsimport.module","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-01T02:36:38Z","receivedAt":"2007-12-01T02:36:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks; will apply to 'maint' along with your earlier fixes.\n"}]}