summaryrefslogtreecommitdiff
path: root/Locations.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-07 17:28:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-07 17:29:55 -0400
commit560b644a52971a7e4706c775982ec29e03ca3ab2 (patch)
tree24f067dffecb1ef18643fbbb1977f9900aef163c /Locations.hs
parent420038580f6d14b0e5a7b1d41b9806c275c4824e (diff)
support for checking presence of objects in direct mode
Also for dropping objects in direct mode. Checking presence reliably needs a cache of mtime, size, and inode. This way, if a file is modified, keys that point to it are no longer present. Also, the code for restoring the symlink when removing objects is unnecessarily messy. calcGitLink was generating links starting with "../../remote/.git/", when running "git annex move --from remote". I put in a workaround, but calcGitLink should probably be fixed. There is not yet support for getting objects from repositories in direct mode; it still looks for content in .git/annex/objects, and there's no once place I can change to fix that. Also, getting objects from direct mode repositories is problematic since the can be changed while the object is being transferred. It probably needs to quarantine it first.
Diffstat (limited to 'Locations.hs')
-rw-r--r--Locations.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Locations.hs b/Locations.hs
index 36172d621..cfe9bd27d 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -12,6 +12,7 @@ module Locations (
keyPath,
gitAnnexLocation,
gitAnnexMapping,
+ gitAnnexCache,
annexLocations,
annexLocation,
gitAnnexDir,
@@ -115,6 +116,14 @@ gitAnnexMapping key r = do
loc <- gitAnnexLocation key r
return $ loc ++ ".map"
+{- File that caches information about a key's content, used to determine
+ - if a file has changed.
+ - Used in direct mode. -}
+gitAnnexCache :: Key -> Git.Repo -> IO FilePath
+gitAnnexCache key r = do
+ loc <- gitAnnexLocation key r
+ return $ loc ++ ".cache"
+
{- The annex directory of a repository. -}
gitAnnexDir :: Git.Repo -> FilePath
gitAnnexDir r = addTrailingPathSeparator $ Git.localGitDir r </> annexDir