diff --git a/Annex/Perms.hs b/Annex/Perms.hs index 73fa6172f1..011ac8b085 100644 --- a/Annex/Perms.hs +++ b/Annex/Perms.hs @@ -106,13 +106,16 @@ annexFileMode = withShared $ return . go go _ = stdFileMode sharedmode = combineModes groupSharedModes -{- Creates a directory inside the gitAnnexDir, creating any parent - - directories up to and including the gitAnnexDir. +{- Creates a directory inside the gitAnnexDir (or possibly the dbdir), + - creating any parent directories up to and including the gitAnnexDir. - Makes directories with appropriate permissions. -} createAnnexDirectory :: RawFilePath -> Annex () createAnnexDirectory dir = do 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 createdir p = do liftIO $ R.createDirectory p diff --git a/Database/Init.hs b/Database/Init.hs index 2b63a38513..0ccde7b19f 100644 --- a/Database/Init.hs +++ b/Database/Init.hs @@ -36,11 +36,12 @@ initDb db migration = do let tmpdb = tmpdbdir P. "db" let tdb = T.pack (fromRawFilePath tmpdb) gc <- Annex.getGitConfig - top <- case annexDbDir gc of - Just topdbdir -> pure $ parentDir $ topdbdir - Nothing -> parentDir <$> fromRepo gitAnnexDir + top <- parentDir <$> fromRepo gitAnnexDir + let tops = case annexDbDir gc of + Just topdbdir -> [top, parentDir topdbdir] + Nothing -> [top] liftIO $ do - createDirectoryUnder [top] tmpdbdir + createDirectoryUnder tops tmpdbdir runSqliteInfo (enableWAL tdb) migration setAnnexDirPerm tmpdbdir -- Work around sqlite bug that prevents it from honoring diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 3e8e4d138c..a401596ef3 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -1230,7 +1230,7 @@ repository, using [[git-annex-config]]. See its man page for a list.) * `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/`. Certian filesystems, such as cifs, may not support locking operations