summaryrefslogtreecommitdiff
path: root/Command/Indirect.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-15 14:52:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-15 14:52:03 -0400
commit454c990ce49af450d3177f2ea9c6132681959078 (patch)
tree9c11d10ccac85d646f7c85a1e51b71efc0a7c28a /Command/Indirect.hs
parenta4ea1393cef234518bfa8dcaeb522259a485b414 (diff)
Direct mode .git/annex/objects directories are no longer left writable
Because that allowed writing to symlinks of files that are not present, which followed the link and put bad content in an object location. fsck: Fix up .git/annex/object directory permissions. This commit was sponsored by an anonymous bitcoin donor.
Diffstat (limited to 'Command/Indirect.hs')
-rw-r--r--Command/Indirect.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/Command/Indirect.hs b/Command/Indirect.hs
index a2512ea96..8b857e2f6 100644
--- a/Command/Indirect.hs
+++ b/Command/Indirect.hs
@@ -20,9 +20,9 @@ import Config
import qualified Annex
import Annex.Direct
import Annex.Content
+import Annex.Content.Direct
import Annex.CatFile
import Annex.Version
-import Annex.Perms
import Annex.Exception
import Init
import qualified Command.Add
@@ -77,7 +77,8 @@ perform = do
Just s
| isSymbolicLink s -> void $ flip whenAnnexed f $
\_ (k, _) -> do
- cleandirect k
+ removeInodeCache k
+ removeAssociatedFiles k
return Nothing
| otherwise ->
maybe noop (fromdirect f)
@@ -87,8 +88,8 @@ perform = do
fromdirect f k = do
showStart "indirect" f
- thawContentDir =<< calcRepo (gitAnnexLocation k)
- cleandirect k -- clean before content directory gets frozen
+ removeInodeCache k
+ removeAssociatedFiles k
whenM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f) $ do
v <-tryAnnexIO (moveAnnex k f)
case v of
@@ -103,10 +104,6 @@ perform = do
warnlocked e = do
warning $ show e
warning "leaving this file as-is; correct this problem and run git annex add on it"
-
- cleandirect k = do
- liftIO . nukeFile =<< calcRepo (gitAnnexInodeCache k)
- liftIO . nukeFile =<< calcRepo (gitAnnexMapping k)
cleanup :: CommandCleanup
cleanup = do