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

[PATCH] cvsserver: Add support for packed refs

From
Lars Noschinski <lars@public.noschinski.de>
Date
Jul 17, 2008, 10:01 UTC
Message-ID
<1216288877-12140-3-git-send-email-lars@public.noschinski.de>
In-Reply-To
<1216288877-12140-2-git-send-email-lars@public.noschinski.de>

req_update still parses /refs/heads manually. Replace this by a call to show-ref.

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
---
 git-cvsserver.perl |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index b00d1c2..0e4f5f9 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -947,24 +947,17 @@ sub req_update
     # projects (heads in this case) to checkout.
     #
     if ($state->{module} eq '') {
-	my $heads_dir = $state->{CVSROOT} . '/refs/heads';
-	if (!opendir HEADS, $heads_dir) {
-	    print "E [server aborted]: Failed to open directory, "
-	      . "$heads_dir: $!\nerror\n";
-	    return 0;
-	}
-        print "E cvs update: Updating .\n";
-	while (my $head = readdir(HEADS)) {
-	    if (-f $state->{CVSROOT} . '/refs/heads/' . $head) {
-	        print "E cvs update: New directory `$head'\n";
-	    }
-	}
-	closedir HEADS;
-	print "ok\n";
-	return 1;
+        my $showref = `git show-ref --heads`;
+        for my $line (split '\n', $showref) {
+            if ( $line =~ m% refs/heads/(.*)$% ) {
+                print "M $1\t$1\n";
+            }
+        }
+        closedir HEADS;
+        print "ok\n";
+        return 1;
     }
 
-
     # Grab a handle to the SQLite db and do any necessary updates
     my $updater = GITCVS::updater->new($state->{CVSROOT}, $state->{module}, $log);
 
-- 
1.5.6.2
Previous: Lars NoschinskiNext: Lars Noschinski
Message 3 of 11 in “Some cvs related fixes and enhancements”
  1. Lars NoschinskiJul 17, 2008
  2. Testsuite: Unset CVS_SERVERLars Noschinski, Jul 17, 2008
  3. cvsserver: Add support for packed refsLars Noschinski, Jul 17, 2008
  4. cvsserver: Add testsuite for packed refsLars Noschinski, Jul 17, 2008
  5. cvsserver: Add cvs co -c supportLars Noschinski, Jul 17, 2008
  6. testsuite for cvs co -cLars Noschinski, Jul 17, 2008
  7. Johannes SchindelinJul 17, 2008
  8. Johannes SchindelinJul 17, 2008
  9. Lars NoschinskiJul 17, 2008
  10. Johannes SchindelinJul 17, 2008
  11. Jeff KingJul 17, 2008

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.