Based on a patch by Jan Wielemaker <jan@xxxxxxxxxxxxxx>. Signed-off-by: Frank Lichtenheld <frank@xxxxxxxxxxxxxx> --- git-cvsserver.perl | 23 +++++++++++++++++++++++ t/t9400-git-cvsserver-server.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 0 deletions(-) Test cases added and fixed behaviour for non-existant files. diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 2e112fa..7374875 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -973,6 +973,29 @@ sub req_update $meta = $updater->getmeta($filename); } + # if we have a -p we should just send the file + if ( exists ( $state->{opt}{p} ) ) + { + if (! defined $meta) + { + # non-existant files are ignored + print "E cvs update: nothing known about `$filename'\n"; + next; + } + if ( open my $fh, '-|', "git-cat-file", "blob", $meta->{filehash} ) + { + while ( <$fh> ) + { + print "M $_"; + } + close $fh or die ("Couldn't close filehandle: $!"); + } else { + die("Couldn't execute git-cat-file"); + } + + next; + } + if ( ! defined $meta ) { $meta = { diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index ee58c0f..4f45578 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -446,6 +446,38 @@ test_expect_success 'cvs update (merge no-op)' \ diff -q merge ../merge' cd "$WORKDIR" +test_expect_success 'cvs update (-p)' \ + 'cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update -p merge non-existant testfile1 empty >log && + cat merge testfile1 empty >../expected && + diff -q log ../expected' + +cd "$WORKDIR" +test_expect_success 'cvs update (-p -r)' \ + 'echo testfile1 >expected && + for i in 1 2 3 4 5 6 7 + do + echo Line $i >>expected + done && + echo >>expected && + cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update -p -r1.1 testfile1 merge empty >log && + diff -q log ../expected' + +cd "$WORKDIR" +test_expect_success 'cvs update (-p unclean and out-of-date)' \ + 'echo testfile2 >testfile2 && + echo Line 10 >>merge && + git add testfile2 merge && + git commit -q -m "update -p" && + git push gitcvs.git >/dev/null && + cat testfile2 merge >expected && + cd cvswork && + echo "Line 10 workdir" >>merge + GIT_CONFIG="$git_config" cvs -Q update -p testfile2 merge >log && + diff -q log ../expected' + +cd "$WORKDIR" cat <<EOF >list-modules-cmd Root $SERVERDIR Valid-responses ok error Valid-requests Force-gzip Referrer Redirect Checked-in New-entry Checksum Copy-file Updated Created Update-existing Merged Patched Rcs-diff Mode Mod-time Removed Remove-entry Set-static-directory Clear-static-directory Set-sticky Clear-sticky Edit-file Template Clear-template Notified Module-expansion Wrapper-rcsOption M Mbinary E F MT -- 1.5.3.4 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html