Fix a case where upgrade to v7 caused git to think that unlocked files were modified

When a file was already unlocked, but the annex object was present, the
upgrade process populated the unlocked file, but neglected to update the
index.

This commit was sponsored by Jochen Bartl on Patreon.
This commit is contained in:
Joey Hess 2018-12-11 13:05:03 -04:00
parent 38dad58c85
commit 11dbb829bc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 19 additions and 4 deletions

View file

@ -14,6 +14,8 @@ import Annex.Version
import Annex.Content
import Annex.ReplaceFile
import Annex.CurrentBranch
import Annex.InodeSentinal
import Utility.InodeCache
import Config
import Git.FilePath
import qualified Git.Ref
@ -84,9 +86,13 @@ scanUnlockedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ do
whenM (inAnnex k) $ do
f <- fromRepo $ fromTopFilePath tf
destmode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus f
replaceFile f $ \tmp ->
ic <- replaceFile f $ \tmp ->
linkFromAnnex k tmp destmode >>= \case
LinkAnnexOk -> return ()
LinkAnnexNoop -> return ()
LinkAnnexFailed -> liftIO $
LinkAnnexOk ->
withTSDelta (liftIO . genInodeCache tmp)
LinkAnnexNoop -> return Nothing
LinkAnnexFailed -> liftIO $ do
writePointerFile tmp k destmode
return Nothing
liftIO $ print ic
maybe noop (restagePointerFile (Restage True) f) ic

View file

@ -13,6 +13,8 @@ git-annex (7.20181206) UNRELEASED; urgency=medium
* webdav: When initializing, avoid trying to make a directory at the top of
the webdav server, which could never accomplish anything and failed on
nextcloud servers. (Reversion introduced in version 6.20170925.)
* Fix a case where upgrade to v7 caused git to think that unlocked files
were modified.
-- Joey Hess <id@joeyh.name> Thu, 06 Dec 2018 13:39:16 -0400

View file

@ -0,0 +1,7 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2018-12-11T17:03:38Z"
content="""
Fixed the problem I described.
"""]]