fix init .git/annex/ perms for core.sharedRepository

init: Bug fix: Create .git/annex/ and .git/annex/fsckdb/ directories with
permissions configured by core.sharedRepository.

The fsckfb being created happens to create .git/annex/ and it was not using
createAnnexDirectory. Probably a reversion partly, but maybe the database
directory was always created not honoring core.sharedRepository?

Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
Joey Hess 2023-04-26 16:09:49 -04:00
parent 7af75a59be
commit f971b199ed
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 4 additions and 10 deletions

View file

@ -29,6 +29,8 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
--json-error-messages is enabled, output a JSON object indicating the --json-error-messages is enabled, output a JSON object indicating the
problem. (But git ls-files --error-unmatch still displays errors about problem. (But git ls-files --error-unmatch still displays errors about
such files in some situations.) such files in some situations.)
* init: Bug fix: Create .git/annex/ and .git/annex/fsckdb/ directories with
permissions configured by core.sharedRepository.
* Warn about unsupported core.sharedRepository=0xxx when set. * Warn about unsupported core.sharedRepository=0xxx when set.
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400 -- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400

View file

@ -10,10 +10,8 @@
module Database.Init where module Database.Init where
import Annex.Common import Annex.Common
import qualified Annex
import Annex.Perms import Annex.Perms
import Utility.FileMode import Utility.FileMode
import Utility.Directory.Create
import qualified Utility.RawFilePath as R import qualified Utility.RawFilePath as R
import Database.Persist.Sqlite import Database.Persist.Sqlite
@ -35,14 +33,8 @@ initDb db migration = do
let tmpdbdir = dbdir <> ".tmp" let tmpdbdir = dbdir <> ".tmp"
let tmpdb = tmpdbdir P.</> "db" let tmpdb = tmpdbdir P.</> "db"
let tdb = T.pack (fromRawFilePath tmpdb) let tdb = T.pack (fromRawFilePath tmpdb)
gc <- Annex.getGitConfig createAnnexDirectory tmpdbdir
top <- parentDir <$> fromRepo gitAnnexDir liftIO $ runSqliteInfo (enableWAL tdb) migration
let tops = case annexDbDir gc of
Just topdbdir -> [top, parentDir (parentDir topdbdir)]
Nothing -> [top]
liftIO $ do
createDirectoryUnder tops tmpdbdir
runSqliteInfo (enableWAL tdb) migration
setAnnexDirPerm tmpdbdir setAnnexDirPerm tmpdbdir
-- Work around sqlite bug that prevents it from honoring -- Work around sqlite bug that prevents it from honoring
-- less restrictive umasks. -- less restrictive umasks.