fix bugs involving v7 unlocked files and direct mode

* Fix bug upgrading from direct mode to v7: when files in the repository
  were already committed as v7 unlocked files elsewhere, and the
  content was present in the direct mode repository, the annexed files
  got their full content checked into git.
* Fix bug that caused v7 unlocked files in a direct mode repository
  to get locked when committing.

This commit was sponsored by Nick Piper on Patreon.
This commit is contained in:
Joey Hess 2018-12-11 13:46:22 -04:00
parent 6718a9b200
commit bbf7dcc193
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 17 additions and 2 deletions

View file

@ -61,7 +61,10 @@ stageDirect = do
shakey <- catKey sha
mstat <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
mcache <- liftIO $ maybe (pure Nothing) (toInodeCache delta file) mstat
filekey <- isAnnexLink file
filekey <- isAnnexLink file >>= \case
Just k -> return (Just k)
-- v7 unlocked pointer file
Nothing -> liftIO (isPointerFile file)
case (shakey, filekey, mstat, mcache) of
(_, Just key, _, _)
| shakey == filekey -> noop

View file

@ -15,6 +15,12 @@ git-annex (7.20181206) UNRELEASED; urgency=medium
nextcloud servers. (Reversion introduced in version 6.20170925.)
* Fix a case where upgrade to v7 caused git to think that unlocked files
were modified.
* Fix bug upgrading from direct mode to v7: when files in the repository
were already committed as v7 unlocked files elsewhere, and the
content was present in the direct mode repository, the annexed files
got their full content checked into git.
* Fix bug that caused v7 unlocked files in a direct mode repository
to get locked when committing.
-- Joey Hess <id@joeyh.name> Thu, 06 Dec 2018 13:39:16 -0400

View file

@ -33,7 +33,6 @@ upgrade :: Bool -> Annex Bool
upgrade automatic = do
unless automatic $
showAction "v5 to v6"
scanUnlockedFiles
whenM isDirect $ do
{- Direct mode makes the same tradeoff of using less disk
- space, with less preservation of old versions of files
@ -62,6 +61,7 @@ upgrade automatic = do
- contents too, don't use git checkout to check out the
- adjust branch. Instead, update HEAD manually. -}
inRepo $ setHeadRef b
scanUnlockedFiles
configureSmudgeFilter
-- Inode sentinal file was only used in direct mode and when
-- locking down files as they were added. In v6, it's used more

View file

@ -9,4 +9,10 @@ Then, the upgrade to v7 from direct mode makes a commit
"commit before upgrade to annex.version 6" which converts the pointer
files into the full file content.
Also, `git annex sync` in the direct mode repo before the upgrade
converted the v7 unlocked files back to locked files. (While also a bug,
this helped mask the other bug..)
Both [[fixed|done]] now.
--[[Joey]]