chiark / gitweb /
dgit-repos-server: make _empty ourselves
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 22 Jan 2014 18:29:18 +0000 (18:29 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 5 Mar 2014 18:29:04 +0000 (18:29 +0000)
dgit-repos-server

index 7c48b2f..2cbb4e7 100755 (executable)
@@ -403,6 +403,15 @@ sub stunthook () {
 
 sub fixmissing__git_upload_pack () {
     $destrepo = "$dgitrepos/_empty";
+    my $lfh = acquiretree($destrepo,1);
+    return if stat $destrepo;
+    die $! unless $!==ENOENT;
+    rmtree "$destrepo.new";
+    umask 022;
+    runcmd qw(git init --bare --quiet), "$destrepo.new";
+    rename "$destrepo.new", $destrepo or die $!;
+    unlink "$destrepo.lock" or die $!;
+    close $lfh;
 }
 
 sub main__git_upload_pack () {