graft exported tree into git-annex branch
So it will be available later and elsewhere, even after GC. I first though to use git update-index to do this, but feeding it a line with a tree object seems to always cause it to generate a git subtree merge. So, fell back to using the Git.Tree interface to maniupulate the trees, and not involving the git-annex branch index file at all. This commit was sponsored by Andreas Karlsson.
This commit is contained in:
parent
978885247e
commit
5483ea90ec
5 changed files with 35 additions and 15 deletions
|
@ -14,6 +14,7 @@ module Git.Tree (
|
|||
recordTree,
|
||||
TreeItem(..),
|
||||
adjustTree,
|
||||
treeMode,
|
||||
) where
|
||||
|
||||
import Common
|
||||
|
@ -94,12 +95,15 @@ mkTree (MkTreeHandle cp) l = CoProcess.query cp send receive
|
|||
send h = do
|
||||
forM_ l $ \i -> hPutStr h $ case i of
|
||||
TreeBlob f fm s -> mkTreeOutput fm BlobObject s f
|
||||
RecordedSubTree f s _ -> mkTreeOutput 0o040000 TreeObject s f
|
||||
RecordedSubTree f s _ -> mkTreeOutput treeMode TreeObject s f
|
||||
NewSubTree _ _ -> error "recordSubTree internal error; unexpected NewSubTree"
|
||||
TreeCommit f fm s -> mkTreeOutput fm CommitObject s f
|
||||
hPutStr h "\NUL" -- signal end of tree to --batch
|
||||
receive h = getSha "mktree" (hGetLine h)
|
||||
|
||||
treeMode :: FileMode
|
||||
treeMode = 0o040000
|
||||
|
||||
mkTreeOutput :: FileMode -> ObjectType -> Sha -> TopFilePath -> String
|
||||
mkTreeOutput fm ot s f = concat
|
||||
[ showOct fm ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue