{"thread":{"id":"8258","subject":"[PATCH 2/3] t9400: Add some more cvs update tests","startedAt":"2007-05-20T22:31:56Z","lastAt":"2007-05-21T17:31:09Z","messageCount":7,"participants":["Frank Lichtenheld","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"42815","messageId":"11797003182642-git-send-email-frank@lichtenheld.de","threadId":"8258","inReplyTo":null,"subject":"[PATCH 1/3] t9400: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-20T22:31:56Z","receivedAt":"2007-05-20T22:31:56Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Add a few test cases for the config file parsing\ndone by git-cvsserver.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9400-git-cvsserver-server.sh |   69 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 69 insertions(+), 0 deletions(-)\n\n Note that this currently has one failing test. This will need\n to be fixed in git-cvsserver though.\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex d406a88..1b63435 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -47,6 +47,75 @@ test_expect_success 'basic checkout' \\\n   'GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master &&\n    test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"'\n \n+#--------------\n+# CONFIG TESTS\n+#--------------\n+\n+test_expect_success 'gitcvs.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   if GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+test_expect_success 'gitcvs.ext.enabled = true' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2'\n+\n+rm -fr cvswork2\n+test_expect_success 'gitcvs.ext.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled false &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+   if GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+test_expect_success 'gitcvs.dbname' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2 &&\n+   test -f \"$SERVERDIR/gitcvs.ext.master.sqlite\" &&\n+   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs.ext.master.sqlite\"'\n+\n+rm -fr cvswork2\n+test_expect_success 'gitcvs.ext.dbname' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&\n+   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2 &&\n+   test -f \"$SERVERDIR/gitcvs1.ext.master.sqlite\" &&\n+   test ! -f \"$SERVERDIR/gitcvs2.ext.master.sqlite\" &&\n+   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs1.ext.master.sqlite\"'\n+\n+\n+#------------\n+# CVS UPDATE\n+#------------\n+\n+rm -fr \"$SERVERDIR\"\n+cd \"$WORKDIR\" &&\n+git clone -q --local --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n+GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.logfile \"$SERVERDIR/gitcvs.log\" ||\n+exit 1\n+\n test_expect_success 'cvs update (create new file)' \\\n   'echo testfile1 >testfile1 &&\n    git add testfile1 &&\n-- \n1.5.2-rc3.GIT\n"},{"id":"42814","messageId":"11797003191512-git-send-email-frank@lichtenheld.de","threadId":"8258","inReplyTo":"11797003182642-git-send-email-frank@lichtenheld.de","subject":"[PATCH 2/3] t9400: Add some more cvs update tests","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-20T22:31:57Z","receivedAt":"2007-05-20T22:31:57Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Add some cvs update tests that include various merge\nsituations. Also add a basic test for update -C\nsince it fits so well in there.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9400-git-cvsserver-server.sh |   69 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 69 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 1b63435..e42943e 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -192,4 +192,73 @@ test_expect_success 'cvs update (re-add deleted file)' \\\n    test \"$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))\" = \"testfile1/1.4/\" &&\n    diff -q testfile1 ../testfile1'\n \n+cd \"$WORKDIR\"\n+test_expect_success 'cvs update (merge)' \\\n+  'echo Line 0 >expected &&\n+   for i in 1 2 3 4 5 6 7\n+   do\n+     echo Line $i >>merge\n+     echo Line $i >>expected\n+   done &&\n+   echo Line 8 >>expected &&\n+   git add merge &&\n+   git commit -q -m \"Merge test (pre-merge)\" &&\n+   git push gitcvs.git >/dev/null &&\n+   cd cvswork &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q update &&\n+   test \"$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))\" = \"merge/1.1/\" &&\n+   diff -q merge ../merge &&\n+   ( echo Line 0; cat merge ) >merge.tmp &&\n+   mv merge.tmp merge &&\n+   cd \"$WORKDIR\" &&\n+   echo Line 8 >>merge &&\n+   git add merge &&\n+   git commit -q -m \"Merge test (merge)\" &&\n+   git push gitcvs.git >/dev/null &&\n+   cd cvswork &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q update &&\n+   diff -q merge ../expected'\n+\n+cd \"$WORKDIR\"\n+\n+cat >expected.C <<EOF\n+<<<<<<< merge.mine\n+Line 0\n+=======\n+LINE 0\n+>>>>>>> merge.3\n+EOF\n+\n+for i in 1 2 3 4 5 6 7 8\n+do\n+  echo Line $i >>expected.C\n+done\n+\n+test_expect_success 'cvs update (conflict merge)' \\\n+  '( echo LINE 0; cat merge ) >merge.tmp &&\n+   mv merge.tmp merge &&\n+   git add merge &&\n+   git commit -q -m \"Merge test (conflict)\" &&\n+   git push gitcvs.git >/dev/null &&\n+   cd cvswork &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q update &&\n+   diff -q merge ../expected.C'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'cvs update (-C)' \\\n+  'cd cvswork &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q update -C &&\n+   diff -q merge ../merge'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'cvs update (merge no-op)' \\\n+   'echo Line 9 >>merge &&\n+    cp merge cvswork/merge &&\n+    git add merge &&\n+    git commit -q -m \"Merge test (no-op)\" &&\n+    git push gitcvs.git >/dev/null &&\n+    cd cvswork &&\n+    GIT_CONFIG=\"$git_config\" cvs -Q update &&\n+    diff -q merge ../merge'\n+\n test_done\n-- \n1.5.2-rc3.GIT\n"},{"id":"42816","messageId":"11797003193447-git-send-email-frank@lichtenheld.de","threadId":"8258","inReplyTo":"11797003191512-git-send-email-frank@lichtenheld.de","subject":"[PATCH 3/3] t9400: Add some basic pserver tests","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-20T22:31:58Z","receivedAt":"2007-05-20T22:31:58Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"While we can easily test the cvs <-> git-cvsserver\ncommunication with :fork: and git-cvsserver server\nthere are some pserver specifics we should test, too.\n\nCurrently this are two tests of the pserver authentication.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9400-git-cvsserver-server.sh |   34 ++++++++++++++++++++++++++++++++++\n 1 files changed, 34 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex e42943e..7f9c6e2 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -47,6 +47,40 @@ test_expect_success 'basic checkout' \\\n   'GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master &&\n    test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"'\n \n+#------------------------\n+# PSERVER AUTHENTICATION\n+#------------------------\n+\n+cat >request-anonymous  <<EOF\n+BEGIN AUTH REQUEST\n+$SERVERDIR\n+anonymous\n+\n+END AUTH REQUEST\n+EOF\n+\n+cat >request-git  <<EOF\n+BEGIN AUTH REQUEST\n+$SERVERDIR\n+git\n+\n+END AUTH REQUEST\n+EOF\n+\n+test_expect_success 'pserver authentication' \\\n+  'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&\n+   tail -n1 log | grep -q \"^I LOVE YOU$\"'\n+\n+test_expect_success 'pserver authentication failure (non-anonymous user)' \\\n+  'if cat request-git | git-cvsserver pserver >log 2>&1\n+   then\n+       false\n+   else\n+       true\n+   fi &&\n+   tail -n1 log | grep -q \"^I HATE YOU$\"'\n+\n+\n #--------------\n # CONFIG TESTS\n #--------------\n-- \n1.5.2-rc3.GIT\n"},{"id":"42831","messageId":"7vlkfjhu2w.fsf@assigned-by-dhcp.cox.net","threadId":"8258","inReplyTo":"11797003182642-git-send-email-frank@lichtenheld.de","subject":"Re: [PATCH 1/3] t9400: Add test cases for config file handling","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-21T00:57:27Z","receivedAt":"2007-05-21T00:57:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This part seems to fail for me and gets an \"unexpected cvs success\".\n\n+rm -fr cvswork2\n+test_expect_success 'gitcvs.ext.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled false &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+   if GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n\nI think the per-method enablement logic is not quite right.\n\n-- >8 --\ngit-cvsserver: ignore global config when per-method config disables an access.\n\nWhen the per-method enable logic disables the access, we should\nnot even look at the global one.\n\n git-cvsserver.perl |    8 +++-----\n 1 files changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex fcfb99d..1de5177 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -192,11 +192,9 @@ sub req_Root\n         }\n     }\n \n-    unless ( ($cfg->{gitcvs}{$state->{method}}{enabled}\n-\t      and $cfg->{gitcvs}{$state->{method}}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i)\n-\t     or ($cfg->{gitcvs}{enabled}\n-\t      and $cfg->{gitcvs}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i) )\n-    {\n+    my $enabled = ($cfg->{gitcvs}{$state->{method}}{enabled}\n+\t\t   || $cfg->{gitcvs}{enabled});\n+    unless ($enabled && $enabled =~ /^\\s*(1|true|yes)\\s*$/i) {\n         print \"E GITCVS emulation needs to be enabled on this repo\\n\";\n         print \"E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\\n\";\n         print \"E \\n\";\n"},{"id":"42900","messageId":"20070521163145.GM4085@planck.djpig.de","threadId":"8258","inReplyTo":"7vlkfjhu2w.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/3] t9400: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-21T16:31:45Z","receivedAt":"2007-05-21T16:31:45Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sun, May 20, 2007 at 05:57:27PM -0700, Junio C Hamano wrote:\n> This part seems to fail for me and gets an \"unexpected cvs success\".\n\nNote the note in the patch ;)\n\n> diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n> index fcfb99d..1de5177 100755\n> --- a/git-cvsserver.perl\n> +++ b/git-cvsserver.perl\n> @@ -192,11 +192,9 @@ sub req_Root\n>          }\n>      }\n>  \n> -    unless ( ($cfg->{gitcvs}{$state->{method}}{enabled}\n> -\t      and $cfg->{gitcvs}{$state->{method}}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i)\n> -\t     or ($cfg->{gitcvs}{enabled}\n> -\t      and $cfg->{gitcvs}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i) )\n> -    {\n> +    my $enabled = ($cfg->{gitcvs}{$state->{method}}{enabled}\n> +\t\t   || $cfg->{gitcvs}{enabled});\n> +    unless ($enabled && $enabled =~ /^\\s*(1|true|yes)\\s*$/i) {\n>          print \"E GITCVS emulation needs to be enabled on this repo\\n\";\n>          print \"E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\\n\";\n>          print \"E \\n\";\n\n\nYeah, should probably have fixed that myself before sending, but the\nother patches were already prepared ;)\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"42901","messageId":"7vtzu6dtd2.fsf@assigned-by-dhcp.cox.net","threadId":"8258","inReplyTo":"20070521163145.GM4085@planck.djpig.de","subject":"Re: [PATCH 1/3] t9400: Add test cases for config file handling","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-21T16:38:49Z","receivedAt":"2007-05-21T16:38:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Frank Lichtenheld <frank@lichtenheld.de> writes:\n\n> On Sun, May 20, 2007 at 05:57:27PM -0700, Junio C Hamano wrote:\n>> This part seems to fail for me and gets an \"unexpected cvs success\".\n>\n> Note the note in the patch ;)\n>\n>> diff --git a/git-cvsserver.perl b/git-cvsserver.perl\n>> index fcfb99d..1de5177 100755\n>> --- a/git-cvsserver.perl\n>> +++ b/git-cvsserver.perl\n>> @@ -192,11 +192,9 @@ sub req_Root\n>>          }\n>>      }\n>>  \n>> -    unless ( ($cfg->{gitcvs}{$state->{method}}{enabled}\n>> -\t      and $cfg->{gitcvs}{$state->{method}}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i)\n>> -\t     or ($cfg->{gitcvs}{enabled}\n>> -\t      and $cfg->{gitcvs}{enabled} =~ /^\\s*(1|true|yes)\\s*$/i) )\n>> -    {\n>> +    my $enabled = ($cfg->{gitcvs}{$state->{method}}{enabled}\n>> +\t\t   || $cfg->{gitcvs}{enabled});\n>> +    unless ($enabled && $enabled =~ /^\\s*(1|true|yes)\\s*$/i) {\n>>          print \"E GITCVS emulation needs to be enabled on this repo\\n\";\n>>          print \"E the repo config file needs a [gitcvs] section added, and the parameter 'enabled' set to 1\\n\";\n>>          print \"E \\n\";\n>\n> Yeah, should probably have fixed that myself before sending, but the\n> other patches were already prepared ;)\n\nOk, so that's an Ack?\n"},{"id":"42905","messageId":"20070521173109.GN4085@planck.djpig.de","threadId":"8258","inReplyTo":"7vtzu6dtd2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/3] t9400: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-21T17:31:09Z","receivedAt":"2007-05-21T17:31:09Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Mon, May 21, 2007 at 09:38:49AM -0700, Junio C Hamano wrote:\n> Frank Lichtenheld <frank@lichtenheld.de> writes:\n> > Yeah, should probably have fixed that myself before sending, but the\n> > other patches were already prepared ;)\n> \n> Ok, so that's an Ack?\n\nYes.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"}]}