diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-12-16 14:53:41 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-12-16 14:53:41 -0400 |
commit | 77a04db58e355f7a610f6a687fbc5b9e02186523 (patch) | |
tree | bbd27731303340b59510f4871e8cc9938801299e /Command/Add.hs | |
parent | 232bca99b0630603c7976f872adb05d232eb5ed8 (diff) |
fix add of file that was locked but has been replaced by a new, unlocked file (v6)
Diffstat (limited to 'Command/Add.hs')
-rw-r--r-- | Command/Add.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 8cbaf189a..ab4e3a9d1 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 |