remove inode cache in unannex

Similar to what commit 675556fd9a 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.
This commit is contained in:
Joey Hess 2021-05-12 11:09:38 -04:00
parent 8dbbbc7250
commit 949627b902
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 6 deletions

View 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 "--"])

View 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