avoid catObjectStream skipping over unavailable shas
Not needed as it's used for --all, but will be needed later.
This commit is contained in:
parent
de3d7d044d
commit
d08c178f97
3 changed files with 10 additions and 18 deletions
|
@ -220,7 +220,7 @@ withKeyOptions' ko auto mkkeyaction fallbackaction params = do
|
|||
Just (f, content) -> do
|
||||
case getk f of
|
||||
Just k -> do
|
||||
Annex.BranchState.setCache (getTopFilePath f) content
|
||||
maybe noop (Annex.BranchState.setCache (getTopFilePath f)) content
|
||||
keyaction (k, mkActionItem k)
|
||||
Nothing -> return ()
|
||||
go reader
|
||||
|
|
|
@ -295,7 +295,7 @@ catObjectStream
|
|||
=> [LsTree.TreeItem]
|
||||
-> (LsTree.TreeItem -> Bool)
|
||||
-> Repo
|
||||
-> (IO (Maybe (TopFilePath, L.ByteString)) -> m ())
|
||||
-> (IO (Maybe (TopFilePath, Maybe L.ByteString)) -> m ())
|
||||
-> m ()
|
||||
catObjectStream l want repo a = assertLocal repo $ do
|
||||
bracketIO start stop $ \(mv, _, _, hout, _) -> a (reader mv hout)
|
||||
|
@ -304,19 +304,21 @@ catObjectStream l want repo a = assertLocal repo $ do
|
|||
forM_ l $ \ti ->
|
||||
when (want ti) $ do
|
||||
let f = LsTree.file ti
|
||||
liftIO $ atomically $ snocTList mv f
|
||||
S8.hPutStrLn h (fromRef' (LsTree.sha ti))
|
||||
let sha = LsTree.sha ti
|
||||
liftIO $ atomically $ snocTList mv (sha, f)
|
||||
S8.hPutStrLn h (fromRef' sha)
|
||||
hClose h
|
||||
|
||||
reader mv h = ifM (hIsEOF h)
|
||||
( return Nothing
|
||||
, do
|
||||
f <- liftIO $ atomically $ headTList mv
|
||||
(sha, f) <- liftIO $ atomically $ headTList mv
|
||||
resp <- S8.hGetLine h
|
||||
case eitherToMaybe $ A.parseOnly respParser resp of
|
||||
Just r -> do
|
||||
case parseResp sha resp of
|
||||
Just r@(ParsedResp {}) -> do
|
||||
content <- readObjectContent h r
|
||||
return (Just (f, content))
|
||||
return (Just (f, Just content))
|
||||
Just DNE -> return (Just (f, Nothing))
|
||||
Nothing -> error $ "unknown response from git cat-file " ++ show resp
|
||||
)
|
||||
|
||||
|
|
|
@ -16,14 +16,4 @@ be as good as --all's was, but it could still be significant.
|
|||
> to get file blob, through cat-file to get key, through cat-file to
|
||||
> precache logs.
|
||||
|
||||
One odd edge case is, could there be a worktree file that refers to a key
|
||||
with no location log? In that case, catObjectStream would skip it. This
|
||||
doesn't usually happen. One case where it does happen is if the git-annex
|
||||
branch is not pulled, but master is.
|
||||
|
||||
Perhaps make catObjectStream not skip them, but return an item
|
||||
with no log file content. It's important things not be reordered when doing
|
||||
that -- could a dummy item somehow be passed through cat-file to represent
|
||||
these problem cases?
|
||||
|
||||
--[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue