git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-cvsserver: fix updates in a subdirectory

From
BBByron Bradley <byronb@picochip.com>
Date
Apr 15, 2009, 11:23 UTC
Message-ID
<alpine.LRH.2.00.0904151222100.885@dunsop.picochip.com>

If you checkout using git-cvsserver then delete a subdirectory and replace it with `cvs checkout -d`, the wrong folder name will be written into CVS/Repository and a `cvs update` in that directory will no longer work. Includes a test case.

Signed-off-by: Byron Bradley <byronb@picochip.com>
---
 git-cvsserver.perl              |    4 ++--
 t/t9400-git-cvsserver-server.sh |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index c320ee9..bb8cbc2 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1117,9 +1117,9 @@ sub req_update
 		} else {
 		    # instruct client we're sending a file to put in this path as a new file
 		    print "Clear-static-directory $dirpart\n";
-		    print $state->{CVSROOT} . "/$state->{module}/$dirpart\n";
+		    print $state->{CVSROOT} . "/$state->{module}/$state->{prependdir}$dirpart\n";
 		    print "Clear-sticky $dirpart\n";
-		    print $state->{CVSROOT} . "/$state->{module}/$dirpart\n";
+		    print $state->{CVSROOT} . "/$state->{module}/$state->{prependdir}$dirpart\n";
 
 		    $log->debug("Creating new file 'Created $dirpart'");
 		    print "Created $dirpart\n";
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 64f947d..201925f 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -352,6 +352,28 @@ test_expect_success 'cvs update (re-add deleted file)' \
    diff -q testfile1 ../testfile1'
 
 cd "$WORKDIR"
+test_expect_success 'cvs update (in a subdirectory)' \
+  'mkdir -p a/b &&
+   echo testfile1 >a/b/test1 &&
+   git add a/b/test1 &&
+   git commit -q -m "Add test1" &&
+   git push gitcvs.git >/dev/null &&
+   cd cvswork &&
+   GIT_CONFIG="$git_config" cvs -Q update &&
+   cd a &&
+   mv b b.bak &&
+   GIT_CONFIG="$git_config" cvs -Q update -d &&
+   test -d b &&
+   cd "$WORKDIR" &&
+   echo testfile2 >a/b/test1 &&
+   git add a/b/test1 &&
+   git commit -q -m "Add test1 again" &&
+   git push gitcvs.git >/dev/null &&
+   cd cvswork/a/b &&
+   GIT_CONFIG="$git_config" cvs -Q update &&
+   diff -q test1 "$WORKDIR/a/b/test1"'
+
+cd "$WORKDIR"
 test_expect_success 'cvs update (merge)' \
   'echo Line 0 >expected &&
    for i in 1 2 3 4 5 6 7
-- 
1.6.3.rc0.2.g8152.dirty
Message 1 of 1 in “git-cvsserver: fix updates in a subdirectory”
  1. git-cvsserver: fix updates in a subdirectoryByron Bradley, Apr 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.