git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Wielemaker <jan@swi-prolog.org>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] git-cvsserver: added support for update -p
Date: Wed, 10 Oct 2007 13:16:03 +0200	[thread overview]
Message-ID: <200710101316.03633.jan@swi-prolog.org> (raw)

[PATCH] git-cvsserver: added support for update -p
---
Hi,

Someone in our team uses "cvs update -p [-r rev] file" (somehow invoked
through TortoiseCVS). The patch below provides that. I think it is fine,
except that I don't know with wich other flags -p can be combined and
therefore when exactly this should be tested. Figured out that normal
CVS sends the file line-by-line preceeded by "M " using strace on the
client to a real CVS server.

	Enjoy --- Jan

 git-cvsserver.perl |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 13dbd27..987f4d6 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -956,6 +956,21 @@ sub req_update
             $meta = $updater->getmeta($filename);
         }
 
+	# if we have a -p we should just send the file
+        if ( exists ( $state->{opt}{p} ) )
+	{
+	    if ( open my $fh, '-|', "git-cat-file", "blob", $meta->{filehash} )
+	    {   while ( <$fh> )
+		{ print "M " . $_;
+		}
+		close $fh or die ("Couldn't close filehandle for transmitfile(): $!");
+	    } else
+	    { die("Couldn't execute git-cat-file");
+	    }
+
+	    next;
+	}
+
 	if ( ! defined $meta )
 	{
 	    $meta = {
-- 
1.5.3.4

             reply	other threads:[~2007-10-10 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 11:16 Jan Wielemaker [this message]
2007-10-10 13:47 ` [PATCH] git-cvsserver: added support for update -p 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 ` [PATCH] cvsserver: " Frank Lichtenheld
2007-10-11 16:52   ` 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=200710101316.03633.jan@swi-prolog.org \
    --to=jan@swi-prolog.org \
    --cc=git@vger.kernel.org \
    /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).