chiark
/
gitweb
/
~ian
/
userv-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
git-daemon: no need for a special configuration variable namespace
[userv-utils.git]
/
git-daemon
/
git-daemon-service.pl
diff --git
a/git-daemon/git-daemon-service.pl
b/git-daemon/git-daemon-service.pl
index ec4b7e1516d357590a0e4b908bd330bc36c72675..c62c9a2c5d7d70533cf7ebe30bc6c42d5a5aacd1 100755
(executable)
--- a/
git-daemon/git-daemon-service.pl
+++ b/
git-daemon/git-daemon-service.pl
@@
-11,28
+11,18
@@
use warnings;
use Sys::Syslog;
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;
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;
$_ = 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 "no repository configured for $uri" unless defined $repo;
fail "no directory configured for $uri" unless defined $dir;
@@
-47,7
+37,7
@@
fail "bad repository in $uri"
fail "repository not exported for $uri"
if $check_export and not -e "$dir/git-daemon-export-ok";
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: $!";
no warnings; # suppress errors to stderr
exec @cmd or fail "exec @cmd: $!";