From 29bb04aa0d656b4b3df787f17f95dd2fd33b1cbe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 3 Feb 2014 11:19:41 -0400 Subject: [PATCH] Windows: Fix deletion of repositories by test suite and webapp. On Windows, a file that is not writable cannot be deleted even if in a directory with write perms. So git object files were not getting deleted when removing a git repository. --- Assistant/WebApp/Configurators/Delete.hs | 8 +++----- Test.hs | 13 ++++++------- debian/changelog | 1 + 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Assistant/WebApp/Configurators/Delete.hs b/Assistant/WebApp/Configurators/Delete.hs index c29e4a681a..f751691539 100644 --- a/Assistant/WebApp/Configurators/Delete.hs +++ b/Assistant/WebApp/Configurators/Delete.hs @@ -96,12 +96,10 @@ deleteCurrentRepository = dangerPage $ do rs <- syncRemotes <$> getDaemonStatus mapM_ (\r -> changeSyncable (Just r) False) rs - {- Make all directories writable, so all annexed - - content can be deleted. -} + {- Make all directories writable and files writable + - so all annexed content can be deleted. -} liftIO $ do - recurseDir SystemFS dir >>= - filterM doesDirectoryExist >>= - mapM_ allowWrite + recurseDir SystemFS dir >>= mapM_ allowWrite removeDirectoryRecursive dir redirect ShutdownConfirmedR diff --git a/Test.hs b/Test.hs index b7f431d6cb..63a081d9fd 100644 --- a/Test.hs +++ b/Test.hs @@ -816,12 +816,12 @@ test_mixed_conflict_resolution env = do indir env r1 $ do writeFile conflictor "conflictor" git_annex env "add" [conflictor] @? "add conflicter failed" - git_annex env "sync" [] @? "sync failed" + git_annex env "sync" [] @? "sync failed in r1" indir env r2 $ do createDirectory conflictor writeFile (conflictor "subfile") "subfile" git_annex env "add" [conflictor] @? "add conflicter failed" - git_annex env "sync" [] @? "sync failed" + git_annex env "sync" [] @? "sync failed in r2" pair env r1 r2 let r = if inr1 then r1 else r2 indir env r $ do @@ -1169,12 +1169,11 @@ cleanup :: FilePath -> IO () cleanup dir = do e <- doesDirectoryExist dir when e $ do - -- git-annex prevents annexed file content from being - -- removed via directory permissions; undo + -- Allow all files and directories to be written to, so + -- they can be deleted. Both git and git-annex use file + -- permissions to prevent this. recurseDir SystemFS dir >>= - filterM doesDirectoryExist >>= - mapM_ Utility.FileMode.allowWrite - -- For unknown reasons, this sometimes fails on Windows. + mapM_ Utility.FileMode.allowWrite void $ tryIO $ removeDirectoryRecursive dir checklink :: FilePath -> Assertion diff --git a/debian/changelog b/debian/changelog index 27ac73a81f..dc58bc87d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,7 @@ git-annex (5.20140128) UNRELEASED; urgency=medium on Windows; the lock files have been sorted out. * Windows: Avoid using unix-compat's rename, which refuses to rename directories. + * Windows: Fix deletion of repositories by test suite and webapp. -- Joey Hess Tue, 28 Jan 2014 13:57:19 -0400