git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] New files in git weren't being downloaded during CVS update

From
APAndy Parkins <andyparkins@gmail.com>
Date
Jan 22, 2007, 10:46 UTC
Message-ID
<200701221046.12795.andyparkins@gmail.com>
In-Reply-To
<200701221044.49467.andyparkins@gmail.com>

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 their 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>
---
 git-cvsserver.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index a33a876..2479f71 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -876,9 +876,9 @@ 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";
-- 
1.5.0.rc2.g3f8f2
Previous: Andy ParkinsNext: Andy Parkins
Message 6 of 8 in “New files in git weren't being downloaded during CVS update”
  1. New files in git weren't being downloaded during CVS updateAndy Parkins, Jan 21, 2007
  2. Junio C HamanoJan 22, 2007
  3. Martin LanghoffJan 22, 2007
  4. Junio C HamanoJan 22, 2007
  5. Andy ParkinsJan 22, 2007
  6. New files in git weren't being downloaded during CVS updateAndy Parkins, Jan 22, 2007
  7. New files in git weren't being downloaded during CVS updateAndy Parkins, Jan 22, 2007
  8. Simon 'corecode' SchubertJan 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.