fix setting imported tree

bf7ecd6892 went too far and broke
importing, the old tree was used on the remote tracking branch and not
the newly imported tree.

Test suite noticed the problem luckily.
This commit is contained in:
Joey Hess 2019-05-06 14:38:02 -04:00
parent 6c7bbe2c5a
commit c5e0f9b3a5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 9 deletions

View file

@ -192,7 +192,7 @@ buildImportCommit' importcommitconfig mtrackingcommit imported@(History ti _) =
let oldimportedtrees = mapHistory historyCommitTree oldimported
mknewcommits oldhc oldimportedtrees imported
Just <$> makeRemoteTrackingBranchMergeCommit'
trackingcommit importedcommit
trackingcommit importedcommit ti
where
h'@(History t s) = mapHistory historyCommitTree h

View file

@ -59,20 +59,20 @@ makeRemoteTrackingBranchMergeCommit tb commitsha =
Just _ -> inRepo (getHistoryToDepth 1 (fromRemoteTrackingBranch tb)) >>= \case
Nothing -> return commitsha
Just (History hc _) -> case historyCommitParents hc of
[_, importhistory] ->
makeRemoteTrackingBranchMergeCommit' commitsha importhistory
[_, importhistory] -> do
treesha <- maybe
(giveup $ "Unable to cat commit " ++ fromRef commitsha)
commitTree
<$> catCommit commitsha
makeRemoteTrackingBranchMergeCommit' commitsha importhistory treesha
-- Earlier versions of git-annex did not
-- make the merge commit, or perhaps
-- something else changed where the
-- tracking branch pointed.
_ -> return commitsha
makeRemoteTrackingBranchMergeCommit' :: Sha -> Sha -> Annex Sha
makeRemoteTrackingBranchMergeCommit' commitsha importedhistory = do
treesha <- maybe
(giveup $ "Unable to cat commit " ++ fromRef commitsha)
commitTree
<$> catCommit commitsha
makeRemoteTrackingBranchMergeCommit' :: Sha -> Sha -> Sha -> Annex Sha
makeRemoteTrackingBranchMergeCommit' commitsha importedhistory treesha =
inRepo $ Git.Branch.commitTree
Git.Branch.AutomaticCommit
"remote tracking branch"