From: Frank Lichtenheld <frank@lichtenheld.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <junkio@cox.net>,
Jan Wielemaker <jan@swi-prolog.org>,
Frank Lichtenheld <frank@lichtenheld.de>
Subject: [PATCH] cvsserver: added support for update -p
Date: Thu, 11 Oct 2007 18:36:13 +0200 [thread overview]
Message-ID: <1192120573-16765-1-git-send-email-frank@lichtenheld.de> (raw)
In-Reply-To: <200710101316.03633.jan@swi-prolog.org>
Based on a patch by Jan Wielemaker <jan@swi-prolog.org>.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
---
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
next prev parent reply other threads:[~2007-10-11 16:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-10 11:16 [PATCH] git-cvsserver: added support for update -p Jan Wielemaker
2007-10-10 13:47 ` Johannes Schindelin
2007-10-10 14:26 ` Jan Wielemaker
2007-10-10 16:41 ` Johannes Schindelin
2007-10-10 17:27 ` Jan Wielemaker
2007-10-10 19:27 ` Johannes Schindelin
2007-10-10 20:00 ` Frank Lichtenheld
2007-10-11 8:45 ` Andreas Ericsson
2007-10-11 16:36 ` Frank Lichtenheld [this message]
2007-10-11 16:52 ` [PATCH] cvsserver: " Jan Wielemaker
2007-10-11 17:29 ` Frank Lichtenheld
2007-10-11 20:59 ` Johannes Schindelin
2007-10-11 21:07 ` Frank Lichtenheld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1192120573-16765-1-git-send-email-frank@lichtenheld.de \
--to=frank@lichtenheld.de \
--cc=git@vger.kernel.org \
--cc=jan@swi-prolog.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).