summaryrefslogtreecommitdiff
path: root/Annex/AdjustedBranch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-03-31 12:04:05 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-03-31 12:04:05 -0400
commitfb5ffecf202dd8c6b9ea13ab383e7332fa88f0f2 (patch)
tree0e23d5a43d718237c4da559756aa361ce929ef51 /Annex/AdjustedBranch.hs
parent423e1b251c275316963257568f0978077871ec9b (diff)
clean up handling of commit lock
Closing the lock manually caused a later exception when the bracket tried to close it again.
Diffstat (limited to 'Annex/AdjustedBranch.hs')
-rw-r--r--Annex/AdjustedBranch.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 8b4712db1..551263cca 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -221,8 +221,8 @@ adjustedBranchCommitMessage = "git-annex adjusted branch"
{- Update the currently checked out adjusted branch, merging the provided
- branch into it. -}
updateAdjustedBranch :: Branch -> (OrigBranch, Adjustment) -> Git.Branch.CommitMode -> Annex Bool
-updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $ do
- preventCommits $ \commitsprevented -> go commitsprevented =<< (,)
+updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $
+ join $ preventCommits $ \commitsprevented -> go commitsprevented =<< (,)
<$> inRepo (Git.Ref.sha tomerge)
<*> inRepo Git.Branch.current
where
@@ -232,18 +232,19 @@ updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $ do
propigateAdjustedCommits' origbranch (adj, currbranch) commitsprevented
adjustedtomerge <- adjust adj mergesha
ifM (inRepo $ Git.Branch.changed currbranch adjustedtomerge)
- ( do
- liftIO $ Git.LockFile.closeLock commitsprevented
+ ( return $ do
+ -- Run after commit lock is dropped.
ifM (autoMergeFrom adjustedtomerge (Just currbranch) commitmode)
( preventCommits $ \commitsprevented' ->
recommit commitsprevented' currbranch mergesha =<< catCommit currbranch
, return False
)
- , return True -- no changes to merge
+ , nochangestomerge
)
- , return True -- no changes to merge
+ , nochangestomerge
)
- go _ _ = return False
+ go _ _ = return $ return False
+ nochangestomerge = return $ return True
{- Once a merge commit has been made, re-do it, removing
- the old version of the adjusted branch as a parent, and
- making the only parent be the branch that was merged in.