avoid locking the journal in readonly repository
The test suite flagged that git-annex info in a readonly repository was no longer working. .git/annex/journal.lck: openFd: permission denied This fixes it, however, in a case where .git/annex/reposize/ is writable, but .git/annex/journal/ is not, there will still be a permission denied error. The solution would just be to use consistent permissions I suppose.
This commit is contained in:
parent
53b7375cc6
commit
133584a83a
2 changed files with 17 additions and 2 deletions
|
@ -138,11 +138,18 @@ calcJournalledRepoSizes
|
|||
-> M.Map UUID RepoSize
|
||||
-> Sha
|
||||
-> Annex (M.Map UUID (RepoSize, SizeOffset))
|
||||
calcJournalledRepoSizes h startmap branchsha =
|
||||
calcJournalledRepoSizes h startmap branchsha
|
||||
-- Lock the journal to prevent updates to the size offsets
|
||||
-- in the repository size database while this is processing
|
||||
-- the journal files.
|
||||
lockJournal $ \_jl -> do
|
||||
| Db.isOpenDb h = lockJournal $ \_jl -> go
|
||||
-- When the repository is not writable, the database won't have
|
||||
-- been opened, and locking the journal would also not succeed.
|
||||
-- But there is no need to lock the journal in this case,
|
||||
-- since no offsets will be read from the database.
|
||||
| otherwise = go
|
||||
where
|
||||
go = do
|
||||
sizemap <- overLocationLogsJournal startmap branchsha
|
||||
(\k v m' -> pure (accumRepoSizes k v m'))
|
||||
Nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue