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 let oldimportedtrees = mapHistory historyCommitTree oldimported
mknewcommits oldhc oldimportedtrees imported mknewcommits oldhc oldimportedtrees imported
Just <$> makeRemoteTrackingBranchMergeCommit' Just <$> makeRemoteTrackingBranchMergeCommit'
trackingcommit importedcommit trackingcommit importedcommit ti
where where
h'@(History t s) = mapHistory historyCommitTree h h'@(History t s) = mapHistory historyCommitTree h

View file

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