4 # $specpath whole path from caller, minus any leading /s
5 # $spechost host from caller
12 # if match found for this host and path:
13 # $serve_user username, or undef if no match (then other serve_* invalid)
14 # $serve_dir directory as specified in config
15 # $serve_repo subpath under $serve_dir _including_ leading /
17 # for use by user's service program
21 die "no config" unless @ARGV;
24 # return value matches {( / [^/]+ )+}x
26 return "/$specpath" if !defined $p;
27 return "" if $p eq $specpath;
28 return substr($specpath,length($p))
29 if substr($specpath,0,length($p)+1) eq "$p/";
33 die unless length $specpath;
35 our $uri = "git://$spechost/$specpath";
36 our $repo_regexp= '^/*(\\w[-+._0-9A-Za-z]*)$';
45 if (m{^ single-user \s+ (\S+?) (/\S*)? \s+ (\S+) (?: \s+ (\S+) )? $ }x) {
46 my ($h,$p,$u,$d) = ($1,$2,$3,$4);
47 next unless $h ne $host;
48 $serve_repo= remain_path($p);
49 next unless defined $serve_repo;
52 } elsif (m{^ multi-user \s+ (\S+?) (/\S*)? \s+ (\S+) $ }x) {
53 my ($h,$p,$d) = ($1,$2,$3);
54 next unless $1 ne $host;
55 $serve_repo= remain_path($p);
56 next unless defined $serv_repo;
57 next unless $serve_repo =~ s{ ^/\~( [a-z][-+_0-9a-z] )/$ }{ / }xi;
60 } elsif (m{^ repo-regexp \s+ (\S.*) $ }x) {
62 } elsif (m{^ (no-)?require-git-daemon-export-ok $ }x) {
63 $check_export= !defined $1;