adjust: Fix some bad behavior when unlocked files use URL keys.
This avoids the smudge --clean filter failing on the URL keys. git checkout runs the post-checkout hook, which runs smudge --update. That populates all the pointer files, but it neglected to store their inode caches in the keys db. With that done, and the keys db flushed before smudge --clean gets run (by restagePointerFile), the isUnmodifiedCheap check can tell the file is not modified, so will not try to re-ingest it, which does not work with URL keys because they do not support genKey. It also seems possible that the isUnmodifiedCheap was also failing for non-URL keys, which would cause them to be re-ingested, leading to a lot of extra work. I have not verified that, but don't see why it wouldn't have happened. So this probably also speeds up checking out adjusted branches. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
parent
df70b307c4
commit
34a535ebea
3 changed files with 7 additions and 2 deletions
|
@ -35,6 +35,7 @@ import Utility.FileMode
|
|||
import Utility.InodeCache
|
||||
import Utility.Tmp.Dir
|
||||
import Utility.CopyFile
|
||||
import qualified Database.Keys.Handle
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
|
@ -202,6 +203,8 @@ restagePointerFile (Restage True) f orig = withTSDelta $ \tsd ->
|
|||
-- updated index file.
|
||||
runner :: Git.Queue.InternalActionRunner Annex
|
||||
runner = Git.Queue.InternalActionRunner "restagePointerFile" $ \r l -> do
|
||||
liftIO . Database.Keys.Handle.flushDbQueue
|
||||
=<< Annex.getState Annex.keysdbhandle
|
||||
realindex <- liftIO $ Git.Index.currentIndexFile r
|
||||
let lock = fromRawFilePath (Git.Index.indexFileLock realindex)
|
||||
lockindex = liftIO $ catchMaybeIO $ Git.LockFile.openLock' lock
|
||||
|
|
|
@ -36,6 +36,7 @@ git-annex (8.20201130) UNRELEASED; urgency=medium
|
|||
* Fix a bug that prevented git-annex init from working in a submodule.
|
||||
* Fix a bug in view filename generation when a metadata value ended with
|
||||
"/" (or ":" or "\" on Windows)
|
||||
* adjust: Fix some bad behavior when unlocked files use URL keys.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 04 Jan 2021 12:52:41 -0400
|
||||
|
||||
|
|
|
@ -255,8 +255,9 @@ updateSmudged restage = streamSmudged $ \k topf -> do
|
|||
f <- fromRepo (fromTopFilePath topf)
|
||||
whenM (inAnnex k) $ do
|
||||
obj <- calcRepo (gitAnnexLocation k)
|
||||
unlessM (isJust <$> populatePointerFile restage k obj f) $
|
||||
liftIO (isPointerFile f) >>= \case
|
||||
populatePointerFile restage k obj f >>= \case
|
||||
Just ic -> Database.Keys.addInodeCaches k [ic]
|
||||
Nothing -> liftIO (isPointerFile f) >>= \case
|
||||
Just k' | k' == k -> toplevelWarning False $
|
||||
"unable to populate worktree file " ++ fromRawFilePath f
|
||||
_ -> noop
|
||||
|
|
Loading…
Reference in a new issue