aboutsummaryrefslogtreecommitdiff
path: root/Remote/GCrypt.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-06 18:29:07 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-06 18:55:56 -0400
commit2bba5bc22d049272d3328bfa6c452d3e2e50e86c (patch)
tree19feab50e43dc330038224ea98b371916ca02133 /Remote/GCrypt.hs
parent014e909a449d0822eff4962a504d6a524abe8fc7 (diff)
made parentDir return a Maybe FilePath; removed most uses of it
parentDir is less safe than takeDirectory, especially when working with relative FilePaths. It's really only useful in loops that want to terminate at / This commit was sponsored by Audric SCHILTKNECHT.
Diffstat (limited to 'Remote/GCrypt.hs')
-rw-r--r--Remote/GCrypt.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs
index 2f2ddc9f3..67021732f 100644
--- a/Remote/GCrypt.hs
+++ b/Remote/GCrypt.hs
@@ -315,7 +315,7 @@ store r rsyncopts
void $ tryIO $ createDirectoryIfMissing True tmpdir
let tmpf = tmpdir </> keyFile k
meteredWriteFile p tmpf b
- let destdir = parentDir $ gCryptLocation r k
+ let destdir = takeDirectory $ gCryptLocation r k
Remote.Directory.finalizeStoreGeneric tmpdir destdir
return True
| Git.repoIsSsh (repo r) = if isShell r
@@ -340,7 +340,7 @@ retrieve r rsyncopts
remove :: Remote -> Remote.Rsync.RsyncOpts -> Remover
remove r rsyncopts k
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $
- liftIO $ Remote.Directory.removeDirGeneric (Git.repoLocation (repo r)) (parentDir (gCryptLocation r k))
+ liftIO $ Remote.Directory.removeDirGeneric (Git.repoLocation (repo r)) (takeDirectory (gCryptLocation r k))
| Git.repoIsSsh (repo r) = shellOrRsync r removeshell removersync
| otherwise = unsupportedUrl
where