Skip to content

Commit

Permalink
New files in git weren't being downloaded during CVS update
Browse files Browse the repository at this point in the history
If a repository was checked out via git-cvsserver and then later a new
file is added to the git repository via some other method; a CVS update
wasn't fetching the new file.

It would be reported as a new file as
 A some/dir/newfile.c
but would never appear in the directory.

The problem seems to be that git-cvsserver was treating these two cases
identically, as "A" type results.

1. New file in repository
2. New file locally

In fact, traditionally, case 1 is treated as a "U" result, and case 2
only is treated as an "A" result.  "A", should just report that the file
is added locally and then skip that file during an update as there is
(of course) nothing to send.

In both these cases there is no working revision, so the checking for
"is there no working revision" will return true.  The test for case 2
needs refining to say "if there is no working revision and no upstream
revision".  This patch does just that, leaving case 1 to be handled by
the normal "U" handler.

I've also updated the log message to more accurately describe the
operation.  i.e. that "A" means that content is scheduled for addition;
not that it actually has been added.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Andy Parkins authored and Junio C Hamano committed Jan 25, 2007
1 parent 5dee29a commit 535514f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions git-cvsserver.perl
Original file line number Diff line number Diff line change
Expand Up @@ -876,17 +876,17 @@ sub req_update
print "MT newline\n";
next;
}
elsif ( !defined($wrev) || $wrev == 0 )
elsif ( (!defined($wrev) || $wrev == 0) && (!defined($meta->{revision}) || $meta->{revision} == 0) )
{
$log->info("Tell the client the file will be added");
$log->info("Tell the client the file is scheduled for addition");
print "MT text A \n";
print "MT fname $filename\n";
print "MT newline\n";
next;

}
else {
$log->info("Updating '$filename' $wrev");
$log->info("Updating '$filename' to ".$meta->{revision});
print "MT +updated\n";
print "MT text U \n";
print "MT fname $filename\n";
Expand Down

0 comments on commit 535514f

Please sign in to comment.