uninit: Avoid failing final removal in some direct mode repositories due to file modes.
Specifically .map files.
This commit is contained in:
parent
ee9ffcd940
commit
c5f132e3e7
4 changed files with 16 additions and 7 deletions
9
Test.hs
9
Test.hs
|
@ -22,9 +22,7 @@ import qualified Options.Applicative.Types as Opt
|
|||
#endif
|
||||
import Control.Exception.Extensible
|
||||
import qualified Data.Map as M
|
||||
import System.IO.HVFS (SystemFS(..))
|
||||
import qualified Text.JSON
|
||||
import System.Path
|
||||
|
||||
import Common
|
||||
|
||||
|
@ -78,6 +76,7 @@ import qualified Utility.Hash
|
|||
import qualified Utility.Scheduled
|
||||
import qualified Utility.HumanTime
|
||||
import qualified Utility.ThreadScheduler
|
||||
import qualified Command.Uninit
|
||||
#ifndef mingw32_HOST_OS
|
||||
import qualified CmdLine.GitAnnex as GitAnnex
|
||||
import qualified Remote.Helper.Encryptable
|
||||
|
@ -1492,11 +1491,7 @@ cleanup = cleanup' False
|
|||
|
||||
cleanup' :: Bool -> FilePath -> IO ()
|
||||
cleanup' final dir = whenM (doesDirectoryExist dir) $ do
|
||||
-- Allow all files and directories to be written to, so
|
||||
-- they can be deleted. Both git and git-annex use file
|
||||
-- permissions to prevent deletion.
|
||||
recurseDir SystemFS dir >>=
|
||||
mapM_ (void . tryIO . Utility.FileMode.allowWrite)
|
||||
Command.Uninit.prepareRemoveAnnexDir dir
|
||||
-- This sometimes fails on Windows, due to some files
|
||||
-- being still opened by a subprocess.
|
||||
catchIO (removeDirectoryRecursive dir) $ \e ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue