From 949627b90240cdfe140aec75519fc21e7be3a149 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 May 2021 11:09:38 -0400 Subject: [PATCH] remove inode cache in unannex 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 | 5 ++--- Command/Unannex.hs | 10 +++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Command/Add.hs b/Command/Add.hs index 3422e065fb..9398865f74 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -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 "--"]) diff --git a/Command/Unannex.hs b/Command/Unannex.hs index 94a89f1502..cfb113dd0a 100644 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -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