X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=scripts%2Fgit-cache-proxy;fp=scripts%2Fgit-cache-proxy;h=0c6ba556d4909dd70b3b7dd3c8ff01a001759bc4;hp=2f38de1154be164d316d7fb06579a22841d521c1;hb=0551f3103af1b31e4cf03bd81c191f34837ef7d1;hpb=eede02a315ee2d05bfada0e62f5a9746046d3492 diff --git a/scripts/git-cache-proxy b/scripts/git-cache-proxy index 2f38de1..0c6ba55 100755 --- a/scripts/git-cache-proxy +++ b/scripts/git-cache-proxy @@ -408,9 +408,16 @@ sub housekeeping () { eval { foreach my $suffix (qw(tmp git)) { my $dir = "${subdir}\\.$suffix"; + my $tdir = "${subdir}\\.tmp"; + if ($dir ne $tdir) { + if (!rename $dir,$tdir) { + next if $! == ENOENT; + die "$dir: cannot rename to $tdir: $!\n"; + } + } my $errs; - remove_tree($dir, { safe=>1, error=>\$errs }); - if (stat $dir) { + remove_tree($tdir, { safe=>1, error=>\$errs }); + if (!stat $tdir) { foreach my $err (@$errs) { my ($file, $message) = %$err; logm 'info', "problem deleting: $file: $message";