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:
parent
c3fb25c317
commit
dd31fe7b9e
3 changed files with 39 additions and 4 deletions
|
@ -172,6 +172,8 @@ gitAnnexLocation' key r config crippled symlinkssupported checker gitdir
|
||||||
{- Bare repositories default to hashDirLower for new
|
{- Bare repositories default to hashDirLower for new
|
||||||
- content, as it's more portable. But check all locations. -}
|
- content, as it's more portable. But check all locations. -}
|
||||||
| Git.repoIsLocalBare r = checkall
|
| Git.repoIsLocalBare r = checkall
|
||||||
|
{- If the repository is configured to only use lower, no need
|
||||||
|
- to check both. -}
|
||||||
| hasDifference ObjectHashLower (annexDifferences config) =
|
| hasDifference ObjectHashLower (annexDifferences config) =
|
||||||
only hashDirLower
|
only hashDirLower
|
||||||
{- Repositories on crippled filesystems use hashDirLower
|
{- Repositories on crippled filesystems use hashDirLower
|
||||||
|
@ -181,10 +183,11 @@ gitAnnexLocation' key r config crippled symlinkssupported checker gitdir
|
||||||
| crippled = if symlinkssupported
|
| crippled = if symlinkssupported
|
||||||
then check $ map inrepo $ reverse $ annexLocations config key
|
then check $ map inrepo $ reverse $ annexLocations config key
|
||||||
else checkall
|
else checkall
|
||||||
{- Regular repositories only use hashDirMixed, so
|
{- Regular repositories usually only use hashDirMixed.
|
||||||
- don't need to do any work to check if the file is
|
- However, it's always possible that a bare repository was
|
||||||
- present. -}
|
- converted to non-bare, or that the cripped filesystem
|
||||||
| otherwise = only hashDirMixed
|
- setting changed, so still need to check both. -}
|
||||||
|
| otherwise = checkall
|
||||||
where
|
where
|
||||||
only = return . inrepo . annexLocation config key
|
only = return . inrepo . annexLocation config key
|
||||||
checkall = check $ map inrepo $ annexLocations config key
|
checkall = check $ map inrepo $ annexLocations config key
|
||||||
|
|
|
@ -2,6 +2,9 @@ git-annex (8.20210715) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* whereused: New command, finds what files use a key, or where a key
|
* whereused: New command, finds what files use a key, or where a key
|
||||||
was used historically.
|
was used historically.
|
||||||
|
* 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.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 14 Jul 2021 14:26:36 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 14 Jul 2021 14:26:36 -0400
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2021-07-15T15:51:16Z"
|
||||||
|
content="""
|
||||||
|
Note that 8.20.200226 is not a valid git-annex version and it would be good
|
||||||
|
to know the actual version used on WSL.
|
||||||
|
|
||||||
|
The mixed-case folder name is what git-annex uses when storing files in a
|
||||||
|
git repository that is not bare. The lower-case 3 letter name is used in a bare
|
||||||
|
repository. It is also used when git-annex detects a crippled filesystem
|
||||||
|
-- which it likely would for a USB drive using FAT or something.
|
||||||
|
Does the repository have annex.crippledfilesystem set in its git config?
|
||||||
|
|
||||||
|
Ok, I found a way to reproduce this. I made a repository with
|
||||||
|
annex.crippledfilesystem set, and copied a file to it. Then I unset
|
||||||
|
annex.crippledfilesystem. Getting the file in another repository then
|
||||||
|
fails.
|
||||||
|
|
||||||
|
git-annex does already deal with cases where a non-bare repo is converted
|
||||||
|
to bare, by trying both names, but it does not in this case.
|
||||||
|
|
||||||
|
I've fixed the problem, but am still curious about how you got into this
|
||||||
|
situation. Anyway, install a git-annex autobuild a few hours after this
|
||||||
|
comment to get the fix.
|
||||||
|
|
||||||
|
(Please use [[bugs]] to report bug reports in the future, this forum is not
|
||||||
|
a BTS and you cause extra work by posting bugs here.)
|
||||||
|
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue