remove inode cache in unannex
authorJoey Hess <joeyh@joeyh.name>
Wed, 12 May 2021 15:09:38 +0000 (11:09 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 12 May 2021 15:09:38 +0000 (11:09 -0400)
Similar to what commit 675556fd9ae682ffcb034fdf454a15fe6e7da979 did for
adding a non-annexed file, this prevents the smudge clean filter
recognising the inode if git add is later run on the unannexed file.

Command/Add.hs
Command/Unannex.hs

index 3422e065fb3d6d20063ef18020c808b77562818e..9398865f74b0087aedc5ff7a7872b47c2c8d7e59 100644 (file)
@@ -141,9 +141,8 @@ addFile smallorlarge ci file = do
                -- filter from being run. So the changes to the database
                -- can be queued up and not flushed to disk immediately.
                Small -> do
-                       withTSDelta (liftIO . genInodeCache file) >>= \case
-                               Just ic -> Database.Keys.removeInodeCache ic
-                               Nothing -> return ()
+                       maybe noop Database.Keys.removeInodeCache
+                               =<< withTSDelta (liftIO . genInodeCache file)
                        return bypassSmudgeConfig
                Large -> return []
        Annex.Queue.addCommand cps "add" (ps++[Param "--"])
index 94a89f15023991705524718b466d13a6eb3d8582..cfb113dd0a834f3dc177cffce019c769fa15ada1 100644 (file)
@@ -14,6 +14,8 @@ import Annex.Link
 import qualified Annex.Queue
 import Utility.CopyFile
 import qualified Database.Keys
+import Utility.InodeCache
+import Annex.InodeSentinal
 import Git.FilePath
 import qualified Utility.RawFilePath as R
 
@@ -55,17 +57,19 @@ perform file key = do
                -- for key' (read from the symlink) to differ from key
                -- (cached in git).
                Just key' -> do
-                       removeassociated
+                       cleanupdb
                        next $ cleanup file key'
                -- If the file is unlocked, it can be unmodified or not and
                -- does not need to be replaced either way.
                Nothing -> do
-                       removeassociated
+                       cleanupdb
                        next $ return True
   where
-       removeassociated = 
+       cleanupdb = do
                Database.Keys.removeAssociatedFile key
                        =<< inRepo (toTopFilePath file)
+               maybe noop Database.Keys.removeInodeCache
+                       =<< withTSDelta (liftIO . genInodeCache file)
 
 cleanup :: RawFilePath -> Key -> CommandCleanup
 cleanup file key = do