Thread (11 messages) flat view 11 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH] cvsserver: Add support for packed refs

From: Lars Noschinski <hidden>
Date: 2016-06-15 22:44:57
Subsystem: the rest · Maintainer: Linus Torvalds

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

Signed-off-by: Lars Noschinski <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help