diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-08-31 18:06:49 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-08-31 18:06:49 -0400 |
commit | 441a5dfc2fd112fd165b95fb1106f15a1255e72a (patch) | |
tree | 856b1ee18a302d8d781b3094833ed5990ee1981d /Git | |
parent | c9629ab97875721c8d36bdaceec25768de610b5e (diff) |
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.
Diffstat (limited to 'Git')
-rw-r--r-- | Git/Tree.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Git/Tree.hs b/Git/Tree.hs index 3e6b85a1d..9e9b17af2 100644 --- a/Git/Tree.hs +++ b/Git/Tree.hs @@ -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 "" |