From: Joey Hess Date: Wed, 16 Dec 2015 18:53:41 +0000 (-0400) Subject: fix add of file that was locked but has been replaced by a new, unlocked file (v6) X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~320^2~184^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2d343224dc0ca67604c1e34b2f77032586a38c8e;p=git-annex.git fix add of file that was locked but has been replaced by a new, unlocked file (v6) --- diff --git a/Command/Add.hs b/Command/Add.hs index 8cbaf189af..ab4e3a9d17 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -34,6 +34,7 @@ import Utility.Tmp import Utility.CopyFile import Annex.InodeSentinal import Annex.Version +import qualified Database.Keys import Control.Exception (IOException) @@ -105,13 +106,22 @@ start file = ifAnnexed file addpresent add next $ if isSymbolicLink s then next $ addFile file else perform file - addpresent key = ifM isDirect + addpresent key = ifM versionSupportsUnlockedPointers ( do ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file case ms of Just s | isSymbolicLink s -> fixup key - _ -> ifM (goodContent key file) ( stop , add ) - , fixup key + _ -> ifM (sameInodeCache file =<< Database.Keys.getInodeCaches key) + ( stop, add ) + , ifM isDirect + ( do + ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file + case ms of + Just s | isSymbolicLink s -> fixup key + _ -> ifM (goodContent key file) + ( stop , add ) + , fixup key + ) ) fixup key = do -- the annexed symlink is present but not yet added to git