{"thread":{"id":"14509","subject":"[PATCH] cvsserver: Add testsuite for packed refs","startedAt":"2008-07-17T17:00:25Z","lastAt":"2008-07-17T17:00:30Z","messageCount":6,"participants":["Lars Noschinski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"83721","messageId":"1216314030-10887-1-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":null,"subject":"Some cvs related fixes and enhancements v2","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:25Z","receivedAt":"2008-07-17T17:00:25Z","isPatch":false,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"\nThis patch series\n\n    - fixes a small bug in the cvsimport testsuite\n    - adds support for packed-refs to cvsserver\n    - adds basic support cvs co -c to cvsserver\n\nChanges to v1:\n\n    - do not change output format of req_up (noticed by Johannes Schindelxein)\n    - test output of the cvs client instead of raw server output\n    - remove superfluous line from the \"cvs co -c\" patch\n\n---\n git-cvsserver.perl              |   34 ++++++++++++++++++++--------------\n t/t9400-git-cvsserver-server.sh |   18 ++++++++++++++++++\n t/t9600-cvsimport.sh            |    1 +\n 3 files changed, 39 insertions(+), 14 deletions(-)\n"},{"id":"83719","messageId":"1216314030-10887-2-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":"1216314030-10887-1-git-send-email-lars@public.noschinski.de","subject":"[PATCH] Testsuite: Unset CVS_SERVER","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:26Z","receivedAt":"2008-07-17T17:00:26Z","isPatch":true,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"From: Fabian Emmes <fabian.emmes@rwth-aachen.de>\n\nThe CVS_SERVER environment variable can cause some of the cvsimport tests\nto fail. So unset this variable at the beginning of the test script.\n\nSigned-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de>\nSigned-off-by: Lars Noschinski <lars@public.noschinski.de>\n---\n t/t9600-cvsimport.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh\nindex 1e01e5c..0d7786a 100755\n--- a/t/t9600-cvsimport.sh\n+++ b/t/t9600-cvsimport.sh\n@@ -5,6 +5,7 @@ test_description='git-cvsimport basic tests'\n \n CVSROOT=$(pwd)/cvsroot\n export CVSROOT\n+unset CVS_SERVER\n # for clean cvsps cache\n HOME=$(pwd)\n export HOME\n-- \n1.5.6.2\n"},{"id":"83718","messageId":"1216314030-10887-3-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":"1216314030-10887-2-git-send-email-lars@public.noschinski.de","subject":"[PATCH] cvsserver: Add support for packed refs","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:27Z","receivedAt":"2008-07-17T17:00:27Z","isPatch":true,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"req_update still parses /refs/heads manually. Replace this by\na call to show-ref.\n\nSigned-off-by: Lars Noschinski <lars@public.noschinski.de>\n---\n git-cvsserver.perl |   22 ++++++++--------------\n 1 files changed, 8 insertions(+), 14 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex b00d1c2..66aebf8 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -947,21 +947,15 @@ sub req_update\n     # projects (heads in this case) to checkout.\n     #\n     if ($state->{module} eq '') {\n-\tmy $heads_dir = $state->{CVSROOT} . '/refs/heads';\n-\tif (!opendir HEADS, $heads_dir) {\n-\t    print \"E [server aborted]: Failed to open directory, \"\n-\t      . \"$heads_dir: $!\\nerror\\n\";\n-\t    return 0;\n-\t}\n+        my $showref = `git show-ref --heads`;\n         print \"E cvs update: Updating .\\n\";\n-\twhile (my $head = readdir(HEADS)) {\n-\t    if (-f $state->{CVSROOT} . '/refs/heads/' . $head) {\n-\t        print \"E cvs update: New directory `$head'\\n\";\n-\t    }\n-\t}\n-\tclosedir HEADS;\n-\tprint \"ok\\n\";\n-\treturn 1;\n+        for my $line (split '\\n', $showref) {\n+            if ( $line =~ m% refs/heads/(.*)$% ) {\n+                print \"E cvs update: New directory `$1'\\n\";\n+            }\n+        }\n+        print \"ok\\n\";\n+        return 1;\n     }\n \n \n-- \n1.5.6.2\n"},{"id":"83717","messageId":"1216314030-10887-4-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":"1216314030-10887-3-git-send-email-lars@public.noschinski.de","subject":"[PATCH] cvsserver: Add testsuite for packed refs","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:28Z","receivedAt":"2008-07-17T17:00:28Z","isPatch":true,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"Check that req_update shows refs, even if all refs are packed.\n\nSigned-off-by: Lars Noschinski <lars@public.noschinski.de>\n---\n t/t9400-git-cvsserver-server.sh |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex e97aaa6..8120087 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -438,6 +438,13 @@ test_expect_success 'cvs update (-p)' '\n     test -z \"$(cat failures)\"\n '\n \n+cd \"$WORKDIR\"\n+test_expect_success 'cvs update (module list supports packed refs)' '\n+    GIT_DIR=\"$SERVERDIR\" git pack-refs --all &&\n+    GIT_CONFIG=\"$git_config\" cvs -n up -d 2> out &&\n+    grep \"cvs update: New directory \\`master'\\''\" < out\n+'\n+\n #------------\n # CVS STATUS\n #------------\n-- \n1.5.6.2\n"},{"id":"83720","messageId":"1216314030-10887-5-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":"1216314030-10887-4-git-send-email-lars@public.noschinski.de","subject":"[PATCH] cvsserver: Add cvs co -c support","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:29Z","receivedAt":"2008-07-17T17:00:29Z","isPatch":true,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"Implement cvs checkout's -c option by returning a list of all \"modules\".\nThis is more useful than displaying a perl warning if -c is given.\n\nSigned-off-by: Lars Noschinski <lars@public.noschinski.de>\n---\n git-cvsserver.perl |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 66aebf8..064952e 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -801,6 +801,18 @@ sub req_co\n \n     argsplit(\"co\");\n \n+    # Provide list of modules, if -c was used.\n+    if (exists $state->{opt}{c}) {\n+        my $showref = `git show-ref --heads`;\n+        for my $line (split '\\n', $showref) {\n+            if ( $line =~ m% refs/heads/(.*)$% ) {\n+                print \"M $1\\t$1\\n\";\n+            }\n+        }\n+        print \"ok\\n\";\n+        return 1;\n+    }\n+\n     my $module = $state->{args}[0];\n     $state->{module} = $module;\n     my $checkout_path = $module;\n-- \n1.5.6.2\n"},{"id":"83722","messageId":"1216314030-10887-6-git-send-email-lars@public.noschinski.de","threadId":"14509","inReplyTo":"1216314030-10887-5-git-send-email-lars@public.noschinski.de","subject":"[PATCH] testsuite for cvs co -c","fromName":"Lars Noschinski","fromEmail":"lars@public.noschinski.de","sentAt":"2008-07-17T17:00:30Z","receivedAt":"2008-07-17T17:00:30Z","isPatch":true,"sender":{"key":"lars@public.noschinski.de","avatar":"https://gravatar.com/avatar/ca62bd8b265f2e26c89d39a4bfe7e390bfa6b16d6400e186e222d1c2382c66f2?d=mp&s=160"},"body":"From: Fabian Emmes <fabian.emmes@rwth-aachen.de>\n\nCheck that all branches are displayed.\n\nSigned-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de>\nSigned-off-by: Lars Noschinski <lars@public.noschinski.de>\n---\n t/t9400-git-cvsserver-server.sh |   11 +++++++++++\n 1 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 8120087..4b91f8d 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -477,4 +477,15 @@ test_expect_success 'cvs status (no subdirs in header)' '\n     ! grep / <../out\n '\n \n+#------------\n+# CVS CHECKOUT\n+#------------\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'cvs co -c (shows module database)' '\n+    GIT_CONFIG=\"$git_config\" cvs co -c > out &&\n+    grep \"^master[\t ]\\+master$\" < out &&\n+    ! grep -v \"^master[\t ]\\+master$\" < out\n+'\n+\n test_done\n-- \n1.5.6.2\n"}]}