From 64fc34b3dab4c3ae1a623d1dce8e8b1110045e33 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 7 Jun 2023 11:10:54 -0400 Subject: [PATCH] narrow window where HEAD is detached Updating an adjusted branch can take a while when there are a lot of files. HEAD was detached at the start, so if eg git-annex sync was interrupted at the wrong point, there was a possibly wide window where it would leave the repo with HEAD detached. There's still a window, just much narrower. I don't know if it's possible to close the window entirely. While git can clearly update the currently checked out branch in eg git merge, it doesn't seem to provide another way to do it. Sponsored-by: Graham Spencer on Patreon --- Annex/AdjustedBranch.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index 2a3d9356a6..cbfa0d6825 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -254,6 +254,8 @@ updateAdjustedBranch adj (AdjBranch currbranch) origbranch -- origbranch. _ <- propigateAdjustedCommits' origbranch adj commitlck + b <- adjustBranch adj origbranch + origheadfile <- inRepo $ readFileStrict . Git.Ref.headFile -- Git normally won't do anything when asked to check @@ -268,7 +270,6 @@ updateAdjustedBranch adj (AdjBranch currbranch) origbranch return (Just newheadfile) _ -> return Nothing - b <- adjustBranch adj origbranch return (b, origheadfile, newheadfile) -- Make git checkout quiet to avoid warnings about