From: Joey Hess Date: Wed, 16 Dec 2015 18:27:12 +0000 (-0400) Subject: fix reversion in v5 git-annex add of unlocked file X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~320^2~184^2~28 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=35f6a78b6635c290789e5102ab5000cebd9bf619;p=git-annex.git fix reversion in v5 git-annex add of unlocked file 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. --- diff --git a/Annex/WorkTree.hs b/Annex/WorkTree.hs index 26144e7f9e..c824e7fc59 100644 --- a/Annex/WorkTree.hs +++ b/Annex/WorkTree.hs @@ -10,6 +10,8 @@ module Annex.WorkTree where 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. @@ -22,7 +24,10 @@ lookupFile file = do 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