aboutsummaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-11-08 14:38:24 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-11-08 14:38:24 -0400
commitd48c28bfffeda0a7b958f5312fa15dc404c5b8c1 (patch)
treea8d08e4671b3079788d7be8a4fde2c1899621c71 /Remote
parent92198a766e356d171bd9e6fdbdcd9d598e2d7280 (diff)
Fix directory special remote's cleanup of empty export directories.
Was trying to rmdir the file, which had already been deleted, and when that failed, it skipped trying to delete the parent directories. Noticed the bug through testremote, but it can't itself detect such problems as there is no enumeration in the API. This commit was sponsored by Brock Spratlen on Patreon.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Directory.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 406af0fdc..f44961ce2 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -276,10 +276,11 @@ renameExportM d _k oldloc newloc = liftIO $ catchBoolIO $ do
exportPath :: FilePath -> ExportLocation -> FilePath
exportPath d loc = d </> fromExportLocation loc
-{- Removes the ExportLocation directory and its parents, so long as
+{- Removes the ExportLocation's parent directory and its parents, so long as
- they're empty, up to but not including the topdir. -}
removeExportLocation :: FilePath -> ExportLocation -> IO ()
-removeExportLocation topdir loc = go (Just $ fromExportLocation loc) (Right ())
+removeExportLocation topdir loc =
+ go (Just $ takeDirectory $ fromExportLocation loc) (Right ())
where
go _ (Left _e) = return ()
go Nothing _ = return ()