From 9db30d60e15847d6faceb8aaf09a1515a13eaaff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Aug 2025 13:35:31 -0400 Subject: [PATCH] improve error when unable to reverse adjust merge Give the user a hint about what to do, as well as what they should have done to avoid the problem. --- Annex/AdjustedBranch.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index 4f72cbd979..e5f7359c95 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -579,8 +579,7 @@ rebaseOnTopMsg = "rebasing adjusted branch on top of updated original branch" - will be lost, and any other headers are not copied either. -} reverseAdjustedCommit :: Sha -> Adjustment -> (Sha, Commit) -> OrigBranch -> Annex Sha reverseAdjustedCommit commitparent adj (csha, basiscommit) origbranch - | length (commitParent basiscommit) > 1 = giveup $ - "unable to propagate merge commit " ++ show csha ++ " back to " ++ show origbranch + | length (commitParent basiscommit) > 1 = giveup mergeerror | otherwise = do cmode <- annexCommitMode <$> Annex.getGitConfig treesha <- reverseAdjustedTree commitparent adj csha @@ -591,6 +590,12 @@ reverseAdjustedCommit commitparent adj (csha, basiscommit) origbranch [commitMessage basiscommit] [commitparent] treesha return revadjcommit + where + mergeerror = "Unable to propagate merge commit " ++ fromRef csha ++ + " back to " ++ fromRef origbranch ++ + " from this adjusted branch." ++ + " To fix this, reset back to before the merge commit, " ++ + " and use: git-annex merge " {- Adjusts the tree of the basis, changing only the files that the - commit changed, and reverse adjusting those changes.