diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-05-10 15:00:19 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-05-10 15:00:22 -0400 |
commit | 07b1aa343b6d82e8f75de606a5647b0a789f76e0 (patch) | |
tree | 800085c0d1a5320c08e6e90b43a1781daa076b2d /Annex | |
parent | c7408c23459c951add738b8a7dc8b18f6e98e178 (diff) |
In the unusual configuration where annex.crippledfilesystem=true but core.symlinks=true, store object contents in mixed case hash directories so that symlinks will point to them.
Contents are searched for in both locations, same as before, so this
does not add any overhead.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Locations.hs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 52753fca8..bdd603d94 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -137,25 +137,28 @@ gitAnnexLocationDepth config = hashlevels + 1 - the actual location of the file's content. -} gitAnnexLocation :: Key -> Git.Repo -> GitConfig -> IO FilePath -gitAnnexLocation key r config = gitAnnexLocation' key r config (annexCrippledFileSystem config) doesFileExist (Git.localGitDir r) -gitAnnexLocation' :: Key -> Git.Repo -> GitConfig -> Bool -> (FilePath -> IO Bool) -> FilePath -> IO FilePath -gitAnnexLocation' key r config crippled checker gitdir +gitAnnexLocation key r config = gitAnnexLocation' key r config (annexCrippledFileSystem config) (coreSymlinks config) doesFileExist (Git.localGitDir r) +gitAnnexLocation' :: Key -> Git.Repo -> GitConfig -> Bool -> Bool -> (FilePath -> IO Bool) -> FilePath -> IO FilePath +gitAnnexLocation' key r config crippled symlinkssupported checker gitdir {- Bare repositories default to hashDirLower for new - - content, as it's more portable. - - - - Repositories on filesystems that are crippled also use - - hashDirLower, since they do not use symlinks and it's - - more portable. - -} - | Git.repoIsLocalBare r || crippled = - check $ map inrepo $ annexLocations config key - | hasDifference ObjectHashLower (annexDifferences config) = - return $ inrepo $ annexLocation config key hashDirLower - {- Non-bare repositories only use hashDirMixed, so + - content, as it's more portable. But check all locations. -} + | Git.repoIsLocalBare r = checkall + | hasDifference ObjectHashLower (annexDifferences config) = + only hashDirLower + {- Repositories on crippled filesystems use hashDirLower + - for new content, unless symlinks are supported too. + - Then hashDirMixed is used. But, the content could be + - in either location so check both. -} + | symlinkssupported = check $ map inrepo $ reverse $ annexLocations config key + | crippled = checkall + {- Regular repositories only use hashDirMixed, so - don't need to do any work to check if the file is - present. -} - | otherwise = return $ inrepo $ annexLocation config key hashDirMixed + | otherwise = only hashDirMixed where + only = return . inrepo . annexLocation config key + checkall = check $ map inrepo $ annexLocations config key + inrepo d = gitdir </> d check locs@(l:_) = fromMaybe l <$> firstM checker locs check [] = error "internal" @@ -166,7 +169,7 @@ gitAnnexLink file key r config = do currdir <- getCurrentDirectory let absfile = fromMaybe whoops $ absNormPathUnix currdir file let gitdir = getgitdir currdir - loc <- gitAnnexLocation' key r config False (\_ -> return True) gitdir + loc <- gitAnnexLocation' key r config False False (\_ -> return True) gitdir toInternalGitPath <$> relPathDirToFile (parentDir absfile) loc where getgitdir currdir |