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
|
Just (f, content) -> do
|
||||||
case getk f of
|
case getk f of
|
||||||
Just k -> do
|
Just k -> do
|
||||||
Annex.BranchState.setCache (getTopFilePath f) content
|
maybe noop (Annex.BranchState.setCache (getTopFilePath f)) content
|
||||||
keyaction (k, mkActionItem k)
|
keyaction (k, mkActionItem k)
|
||||||
Nothing -> return ()
|
Nothing -> return ()
|
||||||
go reader
|
go reader
|
||||||
|
|
|
@ -295,7 +295,7 @@ catObjectStream
|
||||||
=> [LsTree.TreeItem]
|
=> [LsTree.TreeItem]
|
||||||
-> (LsTree.TreeItem -> Bool)
|
-> (LsTree.TreeItem -> Bool)
|
||||||
-> Repo
|
-> Repo
|
||||||
-> (IO (Maybe (TopFilePath, L.ByteString)) -> m ())
|
-> (IO (Maybe (TopFilePath, Maybe L.ByteString)) -> m ())
|
||||||
-> m ()
|
-> m ()
|
||||||
catObjectStream l want repo a = assertLocal repo $ do
|
catObjectStream l want repo a = assertLocal repo $ do
|
||||||
bracketIO start stop $ \(mv, _, _, hout, _) -> a (reader mv hout)
|
bracketIO start stop $ \(mv, _, _, hout, _) -> a (reader mv hout)
|
||||||
|
@ -304,19 +304,21 @@ catObjectStream l want repo a = assertLocal repo $ do
|
||||||
forM_ l $ \ti ->
|
forM_ l $ \ti ->
|
||||||
when (want ti) $ do
|
when (want ti) $ do
|
||||||
let f = LsTree.file ti
|
let f = LsTree.file ti
|
||||||
liftIO $ atomically $ snocTList mv f
|
let sha = LsTree.sha ti
|
||||||
S8.hPutStrLn h (fromRef' (LsTree.sha ti))
|
liftIO $ atomically $ snocTList mv (sha, f)
|
||||||
|
S8.hPutStrLn h (fromRef' sha)
|
||||||
hClose h
|
hClose h
|
||||||
|
|
||||||
reader mv h = ifM (hIsEOF h)
|
reader mv h = ifM (hIsEOF h)
|
||||||
( return Nothing
|
( return Nothing
|
||||||
, do
|
, do
|
||||||
f <- liftIO $ atomically $ headTList mv
|
(sha, f) <- liftIO $ atomically $ headTList mv
|
||||||
resp <- S8.hGetLine h
|
resp <- S8.hGetLine h
|
||||||
case eitherToMaybe $ A.parseOnly respParser resp of
|
case parseResp sha resp of
|
||||||
Just r -> do
|
Just r@(ParsedResp {}) -> do
|
||||||
content <- readObjectContent h r
|
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
|
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
|
> to get file blob, through cat-file to get key, through cat-file to
|
||||||
> precache logs.
|
> 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]]
|
--[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue