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
|
@ -16,6 +16,10 @@ import qualified Command.Unannex
|
|||
import qualified Annex.Branch
|
||||
import Annex.Content
|
||||
import Annex.Init
|
||||
import Utility.FileMode
|
||||
|
||||
import System.IO.HVFS
|
||||
import System.IO.HVFS.Utils
|
||||
|
||||
def :: [Command]
|
||||
def = [addCheck check $ command "uninit" paramPaths seek
|
||||
|
@ -56,6 +60,7 @@ finish = do
|
|||
annexdir <- fromRepo gitAnnexDir
|
||||
annexobjectdir <- fromRepo gitAnnexObjectDir
|
||||
leftovers <- removeUnannexed =<< getKeysPresent InAnnex
|
||||
liftIO $ prepareRemoveAnnexDir annexdir
|
||||
if null leftovers
|
||||
then liftIO $ removeDirectoryRecursive annexdir
|
||||
else error $ unlines
|
||||
|
@ -82,6 +87,12 @@ finish = do
|
|||
[Param "branch", Param "-D", Param $ Git.fromRef Annex.Branch.name]
|
||||
liftIO exitSuccess
|
||||
|
||||
{- Turn on write bits in all remaining files in the annex directory, in
|
||||
- preparation for removal. -}
|
||||
prepareRemoveAnnexDir :: FilePath -> IO ()
|
||||
prepareRemoveAnnexDir annexdir =
|
||||
recurseDir SystemFS annexdir >>= 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