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

index aab35d3..aaa7542 100755 (executable)
@@ -133,6 +133,13 @@ sub acquiretree ($$) {
     return $fh;
 }
 
+sub mkrepotmp () {
+    my $tmpdir = "$dgitrepos/_tmp";
+    return if mkdir $tmpdir;
+    return if $! == EEXIST;
+    die $!;
+}
+
 sub reject ($) {
     die "dgit-repos-server: reject: $_[0]\n";
 }
@@ -146,6 +153,7 @@ sub runcmd {
 #----- git-receive-pack -----
 
 sub fixmissing__git_receive_pack () {
+    mkrepotmp();
     $destrepo = "$dgitrepos/_tmp/${package}_prospective";
     acquiretree($destrepo, 1);
     my $r = system qw(cp -a --), "$dgitrepos/_template", "$destrepo";
@@ -153,6 +161,7 @@ sub fixmissing__git_receive_pack () {
 }
 
 sub makeworkingclone () {
+    mkrepotmp();
     $workrepo = "$dgitrepos/_tmp/${package}_incoming$$";
     acquiretree($workrepo, 1);
     runcmd qw(git clone -l -q --mirror), $destrepo, $workrepo;