@matheusbsbs / matheus-bagliano / commits / b20171ebf7
Fork 0

cvsserver: Add support for packed refs

req_update still parses /refs/heads manually. Replace this by a call to show-ref. Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lars Noschinski committed Jul 17, 2008 at 19:00 UTC b20171ebf7df3c31cce5cde3efaaf257b4ac2447
1 file changed +8 -14
git-cvsserver.perl
+8 -14
@@ -947,21 +947,15 @@ sub req_update
947 # projects (heads in this case) to checkout.
948 #
949 if ($state->{module} eq '') {
950 - my $heads_dir = $state->{CVSROOT} . '/refs/heads';
951 - if (!opendir HEADS, $heads_dir) {
952 - print "E [server aborted]: Failed to open directory, "
953 - . "$heads_dir: $!\nerror\n";
954 - return 0;
955 - }
950 + my $showref = `git show-ref --heads`;
951 print "E cvs update: Updating .\n";
957 - while (my $head = readdir(HEADS)) {
958 - if (-f $state->{CVSROOT} . '/refs/heads/' . $head) {
959 - print "E cvs update: New directory `$head'\n";
960 - }
961 - }
962 - closedir HEADS;
963 - print "ok\n";
964 - return 1;
952 + for my $line (split '\n', $showref) {
953 + if ( $line =~ m% refs/heads/(.*)$% ) {
954 + print "E cvs update: New directory `$1'\n";
955 + }
956 + }
957 + print "ok\n";
958 + return 1;
959 }
960
961