use removeDirGeneric here too for consistency
authorJoey Hess <joeyh@joeyh.name>
Fri, 23 Oct 2020 20:11:39 +0000 (16:11 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 23 Oct 2020 20:12:47 +0000 (16:12 -0400)
And because it might be more robust on windows.

Remote/Directory.hs
doc/bugs/storeKey_when_already_present_failures_on_Windows/comment_3_c570246b0484ed3694efff62feff968c._comment [new file with mode: 0644]

index 377e6ce80fddc978386230a2c3743a800ce6bc67..a4a2c6ccd6b17c3c2f40ec327cdb004c7e33a425 100644 (file)
@@ -195,8 +195,7 @@ store d chunkconfig k b p = liftIO $ do
  - down. -}
 finalizeStoreGeneric :: FilePath -> FilePath -> FilePath -> IO ()
 finalizeStoreGeneric d tmp dest = do
-       void $ tryIO $ allowWrite dest -- may already exist
-       void $ tryIO $ removeDirectoryRecursive dest -- or not exist
+       removeDirGeneric d dest
        createDirectoryUnder d (parentDir dest)
        renameDirectory tmp dest
        -- may fail on some filesystems
diff --git a/doc/bugs/storeKey_when_already_present_failures_on_Windows/comment_3_c570246b0484ed3694efff62feff968c._comment b/doc/bugs/storeKey_when_already_present_failures_on_Windows/comment_3_c570246b0484ed3694efff62feff968c._comment
new file mode 100644 (file)
index 0000000..42ca756
--- /dev/null
@@ -0,0 +1,11 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2020-10-23T20:10:27Z"
+ content="""
+Turns out Remote.Directory was using removeDirGeneric everywhere it needed
+to remove a directory, except for in what I believe is failing here.
+And removeDirGeneric already has a workaround for some windows quirk in it.
+
+So I changed that to use it too. I don't know if that will fix the problem.
+"""]]