In v5, lookupFile is supposed to only look at symlinks on disk (except when
in direct mode).
Note that v6 also has a bug when a locked file's symlink is deleted and is
replaced with a new file. It sees that a link is staged and gets that
key.
import Common.Annex
import Annex.Link
import Annex.CatFile
+import Annex.Version
+import Config
{- Looks up the key corresponding to an annexed file,
- by examining what the file links to.
mkey <- isAnnexLink file
case mkey of
Just key -> makeret key
- Nothing -> maybe (return Nothing) makeret =<< catKeyFile file
+ Nothing -> ifM (versionSupportsUnlockedPointers <||> isDirect)
+ ( maybe (return Nothing) makeret =<< catKeyFile file
+ , return Nothing
+ )
where
makeret = return . Just