DORMANTno replies

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

From: Byron Bradley <hidden>
Date: 2016-06-15 22:46:36
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help