RawFilePath conversion of System.Directory
By using System.Directory.OsPath, which takes and returns OsString, which is a ShortByteString. So, things like dirContents currently have the overhead of copying that to a ByteString, but that should be less than the overhead of using Strings which often in turn were converted to RawFilePaths. Added Utility.OsString and the OsString build flag. That flag is turned on in the stack.yaml, and will be turned on automatically by cabal when built with new enough libraries. The stack.yaml change is a bit ugly, and that could be reverted for now if it causes any problems. Note that Utility.OsString.toOsString on windows is avoiding only a check of encoding that is documented as being unlikely to fail. I don't think it can fail in git-annex; if it could, git-annex didn't contain such an encoding check before, so at worst that should be a wash.
This commit is contained in:
parent
e5be81f8d4
commit
1ceece3108
34 changed files with 222 additions and 138 deletions
|
@ -102,14 +102,14 @@ startCheckIncomplete recordnotok file key =
|
|||
removeAnnexDir :: CommandCleanup -> CommandStart
|
||||
removeAnnexDir recordok = do
|
||||
Annex.Queue.flush
|
||||
annexdir <- fromRawFilePath <$> fromRepo gitAnnexDir
|
||||
annexdir <- fromRepo gitAnnexDir
|
||||
annexobjectdir <- fromRepo gitAnnexObjectDir
|
||||
starting ("uninit objects") (ActionItemOther Nothing) (SeekInput []) $ do
|
||||
leftovers <- removeUnannexed =<< listKeys InAnnex
|
||||
prepareRemoveAnnexDir annexdir
|
||||
if null leftovers
|
||||
then do
|
||||
liftIO $ removeDirectoryRecursive annexdir
|
||||
liftIO $ removeDirectoryRecursive (fromRawFilePath annexdir)
|
||||
next recordok
|
||||
else giveup $ unlines
|
||||
[ "Not fully uninitialized"
|
||||
|
@ -134,15 +134,15 @@ removeAnnexDir recordok = do
|
|||
-
|
||||
- Also closes sqlite databases that might be in the directory,
|
||||
- to avoid later failure to write any cached changes to them. -}
|
||||
prepareRemoveAnnexDir :: FilePath -> Annex ()
|
||||
prepareRemoveAnnexDir :: RawFilePath -> Annex ()
|
||||
prepareRemoveAnnexDir annexdir = do
|
||||
Database.Keys.closeDb
|
||||
liftIO $ prepareRemoveAnnexDir' annexdir
|
||||
|
||||
prepareRemoveAnnexDir' :: FilePath -> IO ()
|
||||
prepareRemoveAnnexDir' :: RawFilePath -> IO ()
|
||||
prepareRemoveAnnexDir' annexdir =
|
||||
emptyWhenDoesNotExist (dirTreeRecursiveSkipping (const False) annexdir)
|
||||
>>= mapM_ (void . tryIO . allowWrite . toRawFilePath)
|
||||
>>= mapM_ (void . tryIO . allowWrite)
|
||||
|
||||
{- Keys that were moved out of the annex have a hard link still in the
|
||||
- annex, with > 1 link count, and those can be removed.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue