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>
This commit is contained in:
Lars Noschinski 2008-07-17 19:00:27 +02:00 committed by Junio C Hamano
parent 374488f31d
commit b20171ebf7

View File

@ -947,21 +947,15 @@ sub req_update
# projects (heads in this case) to checkout. # projects (heads in this case) to checkout.
# #
if ($state->{module} eq '') { if ($state->{module} eq '') {
my $heads_dir = $state->{CVSROOT} . '/refs/heads'; my $showref = `git show-ref --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"; print "E cvs update: Updating .\n";
while (my $head = readdir(HEADS)) { for my $line (split '\n', $showref) {
if (-f $state->{CVSROOT} . '/refs/heads/' . $head) { if ( $line =~ m% refs/heads/(.*)$% ) {
print "E cvs update: New directory `$head'\n"; print "E cvs update: New directory `$1'\n";
} }
} }
closedir HEADS; print "ok\n";
print "ok\n"; return 1;
return 1;
} }