From 637f19bebba21b34980657bdf658d96ad8e2da0c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 8 Jun 2023 13:33:58 -0400 Subject: [PATCH] fix adjusted branch update breakage Introduced recently in commit 64fc34b3dab4c3ae1a623d1dce8e8b1110045e33. adjustBranch changes the sha that is recorded for the current branch (eg the adjusted branch). So, have to get the original sha before calling it. Sponsored-by: Jack Hill on Patreon --- Annex/AdjustedBranch.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index cbfa0d6825..1ace85db53 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -254,18 +254,19 @@ updateAdjustedBranch adj (AdjBranch currbranch) origbranch -- origbranch. _ <- propigateAdjustedCommits' origbranch adj commitlck - b <- adjustBranch adj origbranch - origheadfile <- inRepo $ readFileStrict . Git.Ref.headFile + origheadsha <- inRepo (Git.Ref.sha currbranch) + + b <- adjustBranch adj origbranch -- Git normally won't do anything when asked to check -- out the currently checked out branch, even when its -- ref has changed. Work around this by writing a raw -- sha to .git/HEAD. - newheadfile <- inRepo (Git.Ref.sha currbranch) >>= \case - Just headsha -> do + newheadfile <- case origheadsha of + Just s -> do inRepo $ \r -> do - let newheadfile = fromRef headsha + let newheadfile = fromRef s writeFile (Git.Ref.headFile r) newheadfile return (Just newheadfile) _ -> return Nothing -- 2.30.2