X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=infra%2Fdgit-ssh-dispatch;h=e1fc241250a997d04eed57b584454bd615c032c6;hb=edb1f92ab38d37b03452ca65e5b8394e512fffe8;hp=f29515f53e073c8b19e7345f950a278dad58e896;hpb=10ac2ae8f0d807790ac337b5424a53e8d5e239c2;p=dgit.git diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch index f29515f5..e1fc2412 100755 --- a/infra/dgit-ssh-dispatch +++ b/infra/dgit-ssh-dispatch @@ -111,6 +111,12 @@ sub hasrepo () { } } +sub serve_up ($) { + my ($repo) = @_; + exec qw(git upload-pack --strict --timeout=1000), $repo; + die "exec git: $!"; +} + sub dispatch () { local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'}; @@ -119,8 +125,8 @@ sub dispatch () { prl hasrepo; finish; } elsif ( - m#^${qre}git-([-a-z]+) ${qre}/dgit/($lre)/repos/($lre)\.git${qre}$# - ) { + m#^${qre}git-([-a-z]+) ${qre}/dgit/($lre)/repos/($lre)\.git${qre}$# + ) { my $cmd=$1; selectpackage $2,$3; if ($cmd eq 'receive-pack') { @@ -129,8 +135,7 @@ sub dispatch () { die "exec $s: $!"; } elsif ($cmd eq 'upload-pack') { $repo='$repos/_empty' unless hasrepo; - exec qw(git upload-pack --strict --timeout=1000), $repo; - die "exec git: $!"; + serve_up $repo; } else { die "unsupported git operation $cmd ($_)"; }