adapt recent bug fixes to support private journal
At this point, private repos should mostly work, except for a few commands that directly read from the git-annex branch and will not see the private journal. Private index not yet implemented.
This commit is contained in:
parent
0bb57702e1
commit
24eeacdba8
2 changed files with 21 additions and 14 deletions
|
@ -274,7 +274,8 @@ precache file branchcontent = do
|
||||||
st <- getState
|
st <- getState
|
||||||
content <- if journalIgnorable st
|
content <- if journalIgnorable st
|
||||||
then pure branchcontent
|
then pure branchcontent
|
||||||
else fromMaybe branchcontent <$> getJournalFileStale file
|
else fromMaybe branchcontent
|
||||||
|
<$> getJournalFileStale (GetPrivate True) file
|
||||||
Annex.BranchState.setCache file content
|
Annex.BranchState.setCache file content
|
||||||
|
|
||||||
{- Like get, but does not merge the branch, so the info returned may not
|
{- Like get, but does not merge the branch, so the info returned may not
|
||||||
|
@ -439,17 +440,21 @@ files :: Annex ([RawFilePath], IO Bool)
|
||||||
files = do
|
files = do
|
||||||
_ <- update
|
_ <- update
|
||||||
(bfs, cleanup) <- branchFiles
|
(bfs, cleanup) <- branchFiles
|
||||||
-- ++ forces the content of all but the last list to be buffered in
|
-- ++ forces the content of the first list to be buffered in
|
||||||
-- memory, so use getJournalledFilesStale which should be much smaller
|
-- memory, so use journalledFiles, which should be much smaller
|
||||||
-- most of the time. branchFiles will stream as the list is consumed.
|
-- most of the time. branchFiles will stream as the list is consumed.
|
||||||
l <- (\a b c -> a ++ b ++ c)
|
l <- (++) <$> journalledFiles <*> pure bfs
|
||||||
<$> (if privateUUIDsKnown
|
|
||||||
then getJournalledFilesStale gitAnnexPrivateJournalDir
|
|
||||||
else pure [])
|
|
||||||
<*> (getJournalledFilesStale gitAnnexJournalDir)
|
|
||||||
<*> pure bfs
|
|
||||||
return (l, cleanup)
|
return (l, cleanup)
|
||||||
|
|
||||||
|
{- Lists all files currently in the journal. There may be duplicates in
|
||||||
|
- the list when using a private journal. -}
|
||||||
|
journalledFiles :: Annex [RawFilePath]
|
||||||
|
journalledFiles
|
||||||
|
| privateUUIDsKnown = (++)
|
||||||
|
<$> getJournalledFilesStale gitAnnexPrivateJournalDir
|
||||||
|
<*> getJournalledFilesStale gitAnnexJournalDir
|
||||||
|
| otherwise = getJournalledFilesStale gitAnnexJournalDir
|
||||||
|
|
||||||
{- Files in the branch, not including any from journalled changes,
|
{- Files in the branch, not including any from journalled changes,
|
||||||
- and without updating the branch. -}
|
- and without updating the branch. -}
|
||||||
branchFiles :: Annex ([RawFilePath], IO Bool)
|
branchFiles :: Annex ([RawFilePath], IO Bool)
|
||||||
|
@ -801,7 +806,8 @@ overBranchFileContents select go = do
|
||||||
-- committed to the branch
|
-- committed to the branch
|
||||||
content' <- if journalIgnorable st
|
content' <- if journalIgnorable st
|
||||||
then pure content
|
then pure content
|
||||||
else maybe content Just <$> getJournalFileStale f
|
else maybe content Just
|
||||||
|
<$> getJournalFileStale (GetPrivate True) f
|
||||||
return (Just (v, f, content'))
|
return (Just (v, f, content'))
|
||||||
Nothing
|
Nothing
|
||||||
| journalIgnorable st -> return Nothing
|
| journalIgnorable st -> return Nothing
|
||||||
|
@ -812,7 +818,7 @@ overBranchFileContents select go = do
|
||||||
-- This can cause the action to be run a
|
-- This can cause the action to be run a
|
||||||
-- second time with a file it already ran on.
|
-- second time with a file it already ran on.
|
||||||
| otherwise -> liftIO (tryTakeMVar buf) >>= \case
|
| otherwise -> liftIO (tryTakeMVar buf) >>= \case
|
||||||
Nothing -> drain buf =<< getJournalledFilesStale
|
Nothing -> drain buf =<< journalledFiles
|
||||||
Just fs -> drain buf fs
|
Just fs -> drain buf fs
|
||||||
catObjectStreamLsTree l (select' . getTopFilePath . Git.LsTree.file) g go'
|
catObjectStreamLsTree l (select' . getTopFilePath . Git.LsTree.file) g go'
|
||||||
liftIO $ void cleanup
|
liftIO $ void cleanup
|
||||||
|
@ -825,7 +831,7 @@ overBranchFileContents select go = do
|
||||||
drain buf fs = case getnext fs of
|
drain buf fs = case getnext fs of
|
||||||
Just (v, f, fs') -> do
|
Just (v, f, fs') -> do
|
||||||
liftIO $ putMVar buf fs'
|
liftIO $ putMVar buf fs'
|
||||||
content <- getJournalFileStale f
|
content <- getJournalFileStale (GetPrivate True) f
|
||||||
return (Just (v, f, content))
|
return (Just (v, f, content))
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
liftIO $ putMVar buf []
|
liftIO $ putMVar buf []
|
||||||
|
|
|
@ -49,13 +49,14 @@ instance Journalable Builder where
|
||||||
data RegardingUUID = RegardingUUID [UUID]
|
data RegardingUUID = RegardingUUID [UUID]
|
||||||
|
|
||||||
regardingPrivateUUID :: RegardingUUID -> Bool
|
regardingPrivateUUID :: RegardingUUID -> Bool
|
||||||
regardingPrivateUUID _ = False -- TODO
|
regardingPrivateUUID (RegardingUUID []) = False
|
||||||
|
regardingPrivateUUID (RegardingUUID _) = True -- TODO
|
||||||
|
|
||||||
-- Are any private UUIDs known to exist? If so, extra work has to be done,
|
-- Are any private UUIDs known to exist? If so, extra work has to be done,
|
||||||
-- to check for information separately recorded for them, outside the usual
|
-- to check for information separately recorded for them, outside the usual
|
||||||
-- locations.
|
-- locations.
|
||||||
privateUUIDsKnown :: Bool
|
privateUUIDsKnown :: Bool
|
||||||
privateUUIDsKnown = False -- TODO
|
privateUUIDsKnown = True -- TODO
|
||||||
|
|
||||||
{- Records content for a file in the branch to the journal.
|
{- Records content for a file in the branch to the journal.
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue