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:
Joey Hess 2017-08-31 18:06:49 -04:00
parent 978885247e
commit 5483ea90ec
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 35 additions and 15 deletions

View file

@ -70,7 +70,9 @@ seek :: ExportOptions -> CommandSeek
seek o = do
r <- getParsed (exportRemote o)
new <- fromMaybe (error "unknown tree") <$>
inRepo (Git.Ref.sha (exportTreeish o))
-- Dereference the tree pointed to by the branch, commit,
-- or tag.
inRepo (Git.Ref.tree (exportTreeish o))
old <- getExport (uuid r)
when (length old > 1) $