chiark / gitweb /
dgit-repos-server: Debug when we movetogarbage
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 May 2015 07:58:06 +0000 (08:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:11 +0000 (11:54 +0100)
infra/dgit-repos-server

index ae30eef..634f91e 100755 (executable)
@@ -301,15 +301,21 @@ sub movetogarbage () {
     # purposes (and, I guess, recovery from mistakes).  This is either
     # $garbage or $garbage-old.
     if (stat_exists "$garbagerepo") {
+       printdebug "movetogarbage: rmtree $garbagerepo-tmp\n";
        rmtree "$garbagerepo-tmp";
        if (rename "$garbagerepo-old", "$garbagerepo-tmp") {
+           printdebug "movetogarbage: $garbagerepo-old -> -tmp, rmtree\n";
            rmtree "$garbagerepo-tmp";
        } else {
            die "$garbagerepo $!" unless $!==ENOENT;
+           printdebug "movetogarbage: $garbagerepo-old -> -tmp\n";
        }
+       printdebug "movetogarbage: $garbagerepo -> -old\n";
        rename "$garbagerepo", "$garbagerepo-old" or die "$garbagerepo $!";
     }
-    rename realdestrepo, $garbagerepo
+    my $real = realdestrepo;
+    printdebug "movetogarbage: $real -> $garbagerepo\n";
+    rename $real, $garbagerepo
        or $! == ENOENT
        or die "$garbagerepo $!";
 }