diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-01-27 17:38:06 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-01-27 17:38:06 -0400 |
commit | df81023501e2b0d930ec90cc6f5a6c6735f84818 (patch) | |
tree | 5bd3b9d8f91464bd27c9d86f700b975a76067147 /Locations.hs | |
parent | 1e07d61b9669f85a02551d7858177bd33ffaea6f (diff) |
Repository tuning parameters can now be passed when initializing a repository for the first time.
* init: Repository tuning parameters can now be passed when initializing a
repository for the first time. For details, see
http://git-annex.branchable.com/tuning/
* merge: Refuse to merge changes from a git-annex branch of a repo
that has been tuned in incompatable ways.
Diffstat (limited to 'Locations.hs')
-rw-r--r-- | Locations.hs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Locations.hs b/Locations.hs index 596bf4f85..dcbde4bd9 100644 --- a/Locations.hs +++ b/Locations.hs @@ -76,6 +76,7 @@ import Common import Types import Types.Key import Types.UUID +import Types.Difference import qualified Git {- Conventions: @@ -120,17 +121,22 @@ annexLocation key hasher = objectDir </> keyPath key hasher - the actual location of the file's content. -} gitAnnexLocation :: Key -> Git.Repo -> GitConfig -> IO FilePath -gitAnnexLocation key r config = gitAnnexLocation' key r (annexCrippledFileSystem config) -gitAnnexLocation' :: Key -> Git.Repo -> Bool -> IO FilePath -gitAnnexLocation' key r crippled +gitAnnexLocation key r config = gitAnnexLocation' key r config (annexCrippledFileSystem config) +gitAnnexLocation' :: Key -> Git.Repo -> GitConfig -> Bool -> IO FilePath +gitAnnexLocation' key r config crippled {- 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 key + - more portable. + - + - ObjectHashLower can also be set to force it. + -} + | Git.repoIsLocalBare r + || crippled + || hasDifference (== ObjectHashLower True) (annexDifferences config) = + check $ map inrepo $ annexLocations key {- Non-bare repositories only use hashDirMixed, so - don't need to do any work to check if the file is - present. -} @@ -141,11 +147,11 @@ gitAnnexLocation' key r crippled check [] = error "internal" {- Calculates a symlink to link a file to an annexed object. -} -gitAnnexLink :: FilePath -> Key -> Git.Repo -> IO FilePath -gitAnnexLink file key r = do +gitAnnexLink :: FilePath -> Key -> Git.Repo -> GitConfig -> IO FilePath +gitAnnexLink file key r config = do currdir <- getCurrentDirectory let absfile = fromMaybe whoops $ absNormPathUnix currdir file - loc <- gitAnnexLocation' key r False + loc <- gitAnnexLocation' key r config False relPathDirToFile (parentDir absfile) loc where whoops = error $ "unable to normalize " ++ file |