diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-28 14:14:01 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-28 14:14:01 -0400 |
commit | 094169ce58c798273929d5949576b1e4ccfb8d71 (patch) | |
tree | a3c03bd987c60fa67d63d4c40e58400f9837323e /Remote | |
parent | c25686d17f4b1c7850b8b733b5e63cb829becb3f (diff) |
fix handling of removal of keys that are not present
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Directory.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index cb7553fe2..b107c18e9 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -160,9 +160,15 @@ remove d k = liftIO $ do - before it can delete them. -} void $ tryIO $ mapM_ allowWrite =<< dirContents dir #endif - catchBoolIO $ do + ok <- catchBoolIO $ do removeDirectoryRecursive dir return True + {- Removing the subdirectory will fail if it doesn't exist. + - But, we want to succeed in that case, as long as the directory + - remote's top-level directory does exist. -} + if ok + then return ok + else doesDirectoryExist d <&&> (not <$> doesDirectoryExist dir) where dir = storeDir d k |