fall back to checking lower case hash directories in normal repo

Fix a bug that prevented getting content from a repository that started out
as a bare repository, or had annex.crippledfilesystem set, and was
converted to a non-bare repository.

This unfortunately means that inAnnex check gets slowed down by a stat call
in normal repos when the content is not present. Oh well, such is the cost
of backwards compatability with old mistakes.

Sponsored-by: Mark Reidenbach on Patreon
This commit is contained in:
Joey Hess 2021-07-15 12:16:31 -04:00
parent c3fb25c317
commit dd31fe7b9e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 39 additions and 4 deletions

View file

@ -172,6 +172,8 @@ gitAnnexLocation' key r config crippled symlinkssupported checker gitdir
{- Bare repositories default to hashDirLower for new
- content, as it's more portable. But check all locations. -}
| Git.repoIsLocalBare r = checkall
{- If the repository is configured to only use lower, no need
- to check both. -}
| hasDifference ObjectHashLower (annexDifferences config) =
only hashDirLower
{- Repositories on crippled filesystems use hashDirLower
@ -181,10 +183,11 @@ gitAnnexLocation' key r config crippled symlinkssupported checker gitdir
| crippled = if symlinkssupported
then check $ map inrepo $ reverse $ annexLocations config key
else checkall
{- Regular repositories only use hashDirMixed, so
- don't need to do any work to check if the file is
- present. -}
| otherwise = only hashDirMixed
{- Regular repositories usually only use hashDirMixed.
- However, it's always possible that a bare repository was
- converted to non-bare, or that the cripped filesystem
- setting changed, so still need to check both. -}
| otherwise = checkall
where
only = return . inrepo . annexLocation config key
checkall = check $ map inrepo $ annexLocations config key