aboutsummaryrefslogtreecommitdiff
path: root/git-cvsserver.perl
diff options
context:
space:
mode:
authorFrank Lichtenheld <frank@lichtenheld.de>2007-04-12 00:51:33 +0200
committerJunio C Hamano <junkio@cox.net>2007-04-12 14:59:46 -0700
commit4db0c8dec5c009cbbb61135a321a48278e668a25 (patch)
treec88308ca58d0864d3bc1405461868d5a13710080 /git-cvsserver.perl
parentfebe7dcc088020366bbc601a219a1d6c30ced0c2 (diff)
downloadgit-4db0c8dec5c009cbbb61135a321a48278e668a25.tar.gz
git-4db0c8dec5c009cbbb61135a321a48278e668a25.tar.xz
cvsserver: Allow to "add" a removed file
CVS allows you to add a removed file (where the removal is not yet committed) which will cause the server to send the latest revision of the file and to delete the "removed" status. Copy this behaviour. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-cvsserver.perl')
-rwxr-xr-xgit-cvsserver.perl40
1 files changed, 40 insertions, 0 deletions
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 7fe7949b3..d5674caaa 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -360,12 +360,52 @@ sub req_add
argsplit("add");
+ my $updater = GITCVS::updater->new($state->{CVSROOT}, $state->{module}, $log);
+ $updater->update();
+
+ argsfromdir($updater);
+
my $addcount = 0;
foreach my $filename ( @{$state->{args}} )
{
$filename = filecleanup($filename);
+ my $meta = $updater->getmeta($filename);
+ my $wrev = revparse($filename);
+
+ if ($wrev && $meta && ($wrev < 0))
+ {
+ # previously removed file, add back
+ $log->info("added file $filename was previously removed, send 1.$meta->{revision}");
+
+ print "MT +updated\n";
+ print "MT text U \n";
+ print "MT fname $filename\n";
+ print "MT newline\n";
+ print "MT -updated\n";
+
+ unless ( $state->{globaloptions}{-n} )
+ {
+ my ( $filepart, $dirpart ) = filenamesplit($filename,1);
+
+ print "Created $dirpart\n";
+ print $state->{CVSROOT} . "/$state->{module}/$filename\n";
+
+ # this is an "entries" line
+ my $kopts = kopts_from_path($filepart);
+ $log->debug("/$filepart/1.$meta->{revision}//$kopts/");
+ print "/$filepart/1.$meta->{revision}//$kopts/\n";
+ # permissions
+ $log->debug("SEND : u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}");
+ print "u=$meta->{mode},g=$meta->{mode},o=$meta->{mode}\n";
+ # transmit file
+ transmitfile($meta->{filehash});
+ }
+
+ next;
+ }
+
unless ( defined ( $state->{entries}{$filename}{modified_filename} ) )
{
print "E cvs add: nothing known about `$filename'\n";