fix compaction of export.log

It was not getting old lines removed, because the tree graft confused
the updater, so it union merged from the previous git-annex branch,
which still contained the old lines. Fixed by carefully using setIndexSha.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2017-09-12 18:30:36 -04:00
parent 0fadb620d3
commit f8fd66d3f8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 28 additions and 22 deletions

View file

@ -11,6 +11,7 @@ import qualified Data.Map as M
import Annex.Common
import qualified Annex.Branch
import Annex.Journal
import qualified Git
import qualified Git.Branch
import Git.Tree
@ -97,7 +98,7 @@ recordExportBeginning remoteuuid newtree = do
showExportLog
. changeMapLog c ep new
. parseExportLog
graftTreeish newtree
Annex.Branch.graftTreeish newtree (asTopFilePath "export.tree")
parseExportLog :: String -> MapLog ExportParticipants Exported
parseExportLog = parseMapLog parseExportParticipants parseExported
@ -125,20 +126,3 @@ parseExported :: String -> Maybe Exported
parseExported s = case words s of
(et:it) -> Just $ Exported (Git.Ref et) (map Git.Ref it)
_ -> Nothing
-- To prevent git-annex branch merge conflicts, the treeish is
-- first grafted in and then removed in a subsequent commit.
graftTreeish :: Git.Ref -> Annex ()
graftTreeish treeish = do
branchref <- Annex.Branch.getBranch
Tree t <- inRepo $ getTree branchref
t' <- inRepo $ recordTree $ Tree $
RecordedSubTree (asTopFilePath graftpoint) treeish [] : t
commit <- inRepo $ Git.Branch.commitTree Git.Branch.AutomaticCommit
"export tree" [branchref] t'
origtree <- inRepo $ recordTree (Tree t)
commit' <- inRepo $ Git.Branch.commitTree Git.Branch.AutomaticCommit
"export tree cleanup" [commit] origtree
inRepo $ Git.Branch.update' Annex.Branch.fullname commit'
where
graftpoint = "export.tree"