annex.dbdir fully working
Completes work started in e60766543f
I've verified that all the sqlite databases get stored in annex.dbdir
and are created successfully. If annex.dbdir does not exist, it will be
created; its parent directory must already exist though.
Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
23c6e350cb
commit
a335c1e46e
3 changed files with 12 additions and 8 deletions
|
@ -106,13 +106,16 @@ annexFileMode = withShared $ return . go
|
||||||
go _ = stdFileMode
|
go _ = stdFileMode
|
||||||
sharedmode = combineModes groupSharedModes
|
sharedmode = combineModes groupSharedModes
|
||||||
|
|
||||||
{- Creates a directory inside the gitAnnexDir, creating any parent
|
{- Creates a directory inside the gitAnnexDir (or possibly the dbdir),
|
||||||
- directories up to and including the gitAnnexDir.
|
- creating any parent directories up to and including the gitAnnexDir.
|
||||||
- Makes directories with appropriate permissions. -}
|
- Makes directories with appropriate permissions. -}
|
||||||
createAnnexDirectory :: RawFilePath -> Annex ()
|
createAnnexDirectory :: RawFilePath -> Annex ()
|
||||||
createAnnexDirectory dir = do
|
createAnnexDirectory dir = do
|
||||||
top <- parentDir <$> fromRepo gitAnnexDir
|
top <- parentDir <$> fromRepo gitAnnexDir
|
||||||
createDirectoryUnder' [top] dir createdir
|
tops <- annexDbDir <$> Annex.getGitConfig >>= return . \case
|
||||||
|
Nothing -> [top]
|
||||||
|
Just dbdir -> [top, parentDir dbdir]
|
||||||
|
createDirectoryUnder' tops dir createdir
|
||||||
where
|
where
|
||||||
createdir p = do
|
createdir p = do
|
||||||
liftIO $ R.createDirectory p
|
liftIO $ R.createDirectory p
|
||||||
|
|
|
@ -36,11 +36,12 @@ initDb db migration = do
|
||||||
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
|
gc <- Annex.getGitConfig
|
||||||
top <- case annexDbDir gc of
|
top <- parentDir <$> fromRepo gitAnnexDir
|
||||||
Just topdbdir -> pure $ parentDir $ topdbdir
|
let tops = case annexDbDir gc of
|
||||||
Nothing -> parentDir <$> fromRepo gitAnnexDir
|
Just topdbdir -> [top, parentDir topdbdir]
|
||||||
|
Nothing -> [top]
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
createDirectoryUnder [top] tmpdbdir
|
createDirectoryUnder tops tmpdbdir
|
||||||
runSqliteInfo (enableWAL tdb) migration
|
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
|
||||||
|
|
|
@ -1230,7 +1230,7 @@ repository, using [[git-annex-config]]. See its man page for a list.)
|
||||||
|
|
||||||
* `annex.dbdir`
|
* `annex.dbdir`
|
||||||
|
|
||||||
Set to a directory where git-annex should store its sqlite databases.
|
The directory where git-annex should store its sqlite databases.
|
||||||
The default location is inside `.git/annex/`.
|
The default location is inside `.git/annex/`.
|
||||||
|
|
||||||
Certian filesystems, such as cifs, may not support locking operations
|
Certian filesystems, such as cifs, may not support locking operations
|
||||||
|
|
Loading…
Reference in a new issue