From 9a7da28ee31c201c4ea39efe220ed19026479260 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 26 Aug 2007 01:08:28 +0200 Subject: [PATCH] Create separate http_alternates --- cgi/Git/RepoCGI.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cgi/Git/RepoCGI.pm b/cgi/Git/RepoCGI.pm index 4278866..a82d586 100644 --- a/cgi/Git/RepoCGI.pm +++ b/cgi/Git/RepoCGI.pm @@ -321,13 +321,22 @@ sub _alternates_setup { mkdir $self->{path}.'/refs'; chmod 0775, $self->{path}.'/refs'; mkdir $self->{path}.'/objects'; chmod 0775, $self->{path}.'/objects'; mkdir $self->{path}.'/objects/info'; chmod 0775, $self->{path}.'/objects/info'; + + # We set up both alternates and http_alternates since we cannot use + # relative path in alternates - that doesn't work recursively. + my $filename = $self->{path}.'/objects/info/alternates'; open X, '>'.$filename or die "alternates failed: $!"; - # We use relative URL here so that http-fetch groks it automagically. - $forkee_name =~ s#^.*/##; # Only the last element of the path matters, again. print X "$forkee_path/objects\n"; close X; chmod 0664, $filename or warn "cannot chmod $filename: $!"; + + my $filename = $self->{path}.'/objects/info/http_alternates'; + open X, '>'.$filename or die "http_alternates failed: $!"; + print X "/r/$forkee_name.git\n"; + close X; + chmod 0664, $filename or warn "cannot chmod $filename: $!"; + symlink "$forkee_path/refs", $self->{path}.'/refs/forkee'; } -- 2.11.4.GIT