use Sys::Syslog;
-my $service = $ENV{"USERV_SERVICE"};
-$service =~ s|^git-||;
+our $check_repo = 1;
+our $check_export = 0;
+our ($service,$client,$dir,$repo);
-${$cf::{$_}} = $ENV{"USERV_U_$_"}
+${$main::{$_}} = $ENV{"USERV_U_$_"}
for grep s/^USERV_U_//, keys %ENV;
-openlog 'userv-git-daemon/$service', 'pid', 'daemon';
-
-sub cf::fail {
- syslog 'err', "$cf::client @_";
- exit;
-}
+openlog 'userv-$service', 'pid', 'daemon';
+sub fail { syslog 'err', "$client @_"; exit }
-package cf;
-
-our $check_repo = 1;
-our $check_export = 0;
-our ($dir,$repo,$client);
$_ = our $uri;
-for my $cf (@ARGV) {
- do $cf;
-}
+for my $cf (@ARGV) { do $cf }
fail "no repository configured for $uri" unless defined $repo;
fail "no directory configured for $uri" unless defined $dir;
fail "repository not exported for $uri"
if $check_export and not -e "$dir/git-daemon-export-ok";
-my @cmd = ('git', $service, '--strict', '--timeout=30', $dir);
+my @cmd = ($service, '--strict', '--timeout=30', $dir);
no warnings; # suppress errors to stderr
exec @cmd or fail "exec @cmd: $!";