threads / patch / 14509

patchcvsserver: Add testsuite for packed refs

Subject: [PATCH] cvsserver: Add testsuite for packed refs

## tl;dr

6 messages between Jul 17, 2008 and Jul 17, 2008. Diffs are folded; open one to read it.

replies: 5people: 1as markdown or json

Lars Noschinski· Jul 17, 2008, 17:00 UTC · lore

Some cvs related fixes and enhancements v2

This patch series
    - fixes a small bug in the cvsimport testsuite
    - adds support for packed-refs to cvsserver
    - adds basic support cvs co -c to cvsserver
Changes to v1:
    - do not change output format of req_up (noticed by Johannes Schindelxein)
    - test output of the cvs client instead of raw server output
    - remove superfluous line from the "cvs co -c" patch
---
 git-cvsserver.perl              |   34 ++++++++++++++++++++--------------
 t/t9400-git-cvsserver-server.sh |   18 ++++++++++++++++++
 t/t9600-cvsimport.sh            |    1 +
 3 files changed, 39 insertions(+), 14 deletions(-)
Lars Noschinski· Jul 17, 2008, 17:00 UTC · re: Lars Noschinski · lore

[PATCH] Testsuite: Unset CVS_SERVER

From: Fabian Emmes <fabian.emmes@rwth-aachen.de>

The CVS_SERVER environment variable can cause some of the cvsimport tests to fail. So unset this variable at the beginning of the test script.

Signed-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de>
Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 t/t9600-cvsimport.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to t/t9600-cvsimport.sh +1 −0
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 1e01e5c..0d7786a 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -5,6 +5,7 @@ test_description='git-cvsimport basic tests'
 
 CVSROOT=$(pwd)/cvsroot
 export CVSROOT
+unset CVS_SERVER
 # for clean cvsps cache
 HOME=$(pwd)
 export HOME
-- 
1.5.6.2
Lars Noschinski· Jul 17, 2008, 17:00 UTC · re: Lars Noschinski · lore

[PATCH] cvsserver: Add support for packed refs

req_update still parses /refs/heads manually. Replace this by a call to show-ref.

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 git-cvsserver.perl |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)
Show changes to git-cvsserver.perl +8 −14
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index b00d1c2..66aebf8 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -947,21 +947,15 @@ sub req_update
     # projects (heads in this case) to checkout.
     #
     if ($state->{module} eq '') {
-	my $heads_dir = $state->{CVSROOT} . '/refs/heads';
-	if (!opendir HEADS, $heads_dir) {
-	    print "E [server aborted]: Failed to open directory, "
-	      . "$heads_dir: $!\nerror\n";
-	    return 0;
-	}
+        my $showref = `git show-ref --heads`;
         print "E cvs update: Updating .\n";
-	while (my $head = readdir(HEADS)) {
-	    if (-f $state->{CVSROOT} . '/refs/heads/' . $head) {
-	        print "E cvs update: New directory `$head'\n";
-	    }
-	}
-	closedir HEADS;
-	print "ok\n";
-	return 1;
+        for my $line (split '\n', $showref) {
+            if ( $line =~ m% refs/heads/(.*)$% ) {
+                print "E cvs update: New directory `$1'\n";
+            }
+        }
+        print "ok\n";
+        return 1;
     }
 
 
-- 
1.5.6.2
Lars Noschinski· Jul 17, 2008, 17:00 UTC · re: Lars Noschinski · lore
Check that req_update shows refs, even if all refs are packed.
Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 t/t9400-git-cvsserver-server.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Show changes to t/t9400-git-cvsserver-server.sh +7 −0
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index e97aaa6..8120087 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -438,6 +438,13 @@ test_expect_success 'cvs update (-p)' '
     test -z "$(cat failures)"
 '
 
+cd "$WORKDIR"
+test_expect_success 'cvs update (module list supports packed refs)' '
+    GIT_DIR="$SERVERDIR" git pack-refs --all &&
+    GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
+    grep "cvs update: New directory \`master'\''" < out
+'
+
 #------------
 # CVS STATUS
 #------------
-- 
1.5.6.2
Lars Noschinski· Jul 17, 2008, 17:00 UTC · re: Lars Noschinski · lore

[PATCH] cvsserver: Add cvs co -c support

Implement cvs checkout's -c option by returning a list of all "modules". This is more useful than displaying a perl warning if -c is given.

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 git-cvsserver.perl |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Show changes to git-cvsserver.perl +12 −0
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 66aebf8..064952e 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -801,6 +801,18 @@ sub req_co
 
     argsplit("co");
 
+    # Provide list of modules, if -c was used.
+    if (exists $state->{opt}{c}) {
+        my $showref = `git show-ref --heads`;
+        for my $line (split '\n', $showref) {
+            if ( $line =~ m% refs/heads/(.*)$% ) {
+                print "M $1\t$1\n";
+            }
+        }
+        print "ok\n";
+        return 1;
+    }
+
     my $module = $state->{args}[0];
     $state->{module} = $module;
     my $checkout_path = $module;
-- 
1.5.6.2
Lars Noschinski· Jul 17, 2008, 17:00 UTC · re: Lars Noschinski · lore

[PATCH] testsuite for cvs co -c

From: Fabian Emmes <fabian.emmes@rwth-aachen.de>
Check that all branches are displayed.
Signed-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de>
Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 t/t9400-git-cvsserver-server.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
Show changes to t/t9400-git-cvsserver-server.sh +11 −0
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 8120087..4b91f8d 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -477,4 +477,15 @@ test_expect_success 'cvs status (no subdirs in header)' '
     ! grep / <../out
 '
 
+#------------
+# CVS CHECKOUT
+#------------
+
+cd "$WORKDIR"
+test_expect_success 'cvs co -c (shows module database)' '
+    GIT_CONFIG="$git_config" cvs co -c > out &&
+    grep "^master[	 ]\+master$" < out &&
+    ! grep -v "^master[	 ]\+master$" < out
+'
+
 test_done
-- 
1.5.6.2

← back to recent threads