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.
This commit is contained in:
parent
01df5ed31d
commit
29bb04aa0d
3 changed files with 10 additions and 12 deletions
|
@ -96,12 +96,10 @@ deleteCurrentRepository = dangerPage $ do
|
||||||
rs <- syncRemotes <$> getDaemonStatus
|
rs <- syncRemotes <$> getDaemonStatus
|
||||||
mapM_ (\r -> changeSyncable (Just r) False) rs
|
mapM_ (\r -> changeSyncable (Just r) False) rs
|
||||||
|
|
||||||
{- Make all directories writable, so all annexed
|
{- Make all directories writable and files writable
|
||||||
- content can be deleted. -}
|
- so all annexed content can be deleted. -}
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
recurseDir SystemFS dir >>=
|
recurseDir SystemFS dir >>= mapM_ allowWrite
|
||||||
filterM doesDirectoryExist >>=
|
|
||||||
mapM_ allowWrite
|
|
||||||
removeDirectoryRecursive dir
|
removeDirectoryRecursive dir
|
||||||
|
|
||||||
redirect ShutdownConfirmedR
|
redirect ShutdownConfirmedR
|
||||||
|
|
11
Test.hs
11
Test.hs
|
@ -816,12 +816,12 @@ test_mixed_conflict_resolution env = do
|
||||||
indir env r1 $ do
|
indir env r1 $ do
|
||||||
writeFile conflictor "conflictor"
|
writeFile conflictor "conflictor"
|
||||||
git_annex env "add" [conflictor] @? "add conflicter failed"
|
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
|
indir env r2 $ do
|
||||||
createDirectory conflictor
|
createDirectory conflictor
|
||||||
writeFile (conflictor </> "subfile") "subfile"
|
writeFile (conflictor </> "subfile") "subfile"
|
||||||
git_annex env "add" [conflictor] @? "add conflicter failed"
|
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
|
pair env r1 r2
|
||||||
let r = if inr1 then r1 else r2
|
let r = if inr1 then r1 else r2
|
||||||
indir env r $ do
|
indir env r $ do
|
||||||
|
@ -1169,12 +1169,11 @@ cleanup :: FilePath -> IO ()
|
||||||
cleanup dir = do
|
cleanup dir = do
|
||||||
e <- doesDirectoryExist dir
|
e <- doesDirectoryExist dir
|
||||||
when e $ do
|
when e $ do
|
||||||
-- git-annex prevents annexed file content from being
|
-- Allow all files and directories to be written to, so
|
||||||
-- removed via directory permissions; undo
|
-- they can be deleted. Both git and git-annex use file
|
||||||
|
-- permissions to prevent this.
|
||||||
recurseDir SystemFS dir >>=
|
recurseDir SystemFS dir >>=
|
||||||
filterM doesDirectoryExist >>=
|
|
||||||
mapM_ Utility.FileMode.allowWrite
|
mapM_ Utility.FileMode.allowWrite
|
||||||
-- For unknown reasons, this sometimes fails on Windows.
|
|
||||||
void $ tryIO $ removeDirectoryRecursive dir
|
void $ tryIO $ removeDirectoryRecursive dir
|
||||||
|
|
||||||
checklink :: FilePath -> Assertion
|
checklink :: FilePath -> Assertion
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -21,6 +21,7 @@ git-annex (5.20140128) UNRELEASED; urgency=medium
|
||||||
on Windows; the lock files have been sorted out.
|
on Windows; the lock files have been sorted out.
|
||||||
* Windows: Avoid using unix-compat's rename, which refuses to rename
|
* Windows: Avoid using unix-compat's rename, which refuses to rename
|
||||||
directories.
|
directories.
|
||||||
|
* Windows: Fix deletion of repositories by test suite and webapp.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Tue, 28 Jan 2014 13:57:19 -0400
|
-- Joey Hess <joeyh@debian.org> Tue, 28 Jan 2014 13:57:19 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue