clean up handling of commit lock
Closing the lock manually caused a later exception when the bracket tried to close it again.
This commit is contained in:
parent
f63b839763
commit
02ce75c87d
1 changed files with 8 additions and 7 deletions
|
@ -221,8 +221,8 @@ adjustedBranchCommitMessage = "git-annex adjusted branch"
|
||||||
{- Update the currently checked out adjusted branch, merging the provided
|
{- Update the currently checked out adjusted branch, merging the provided
|
||||||
- branch into it. -}
|
- branch into it. -}
|
||||||
updateAdjustedBranch :: Branch -> (OrigBranch, Adjustment) -> Git.Branch.CommitMode -> Annex Bool
|
updateAdjustedBranch :: Branch -> (OrigBranch, Adjustment) -> Git.Branch.CommitMode -> Annex Bool
|
||||||
updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $ do
|
updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $
|
||||||
preventCommits $ \commitsprevented -> go commitsprevented =<< (,)
|
join $ preventCommits $ \commitsprevented -> go commitsprevented =<< (,)
|
||||||
<$> inRepo (Git.Ref.sha tomerge)
|
<$> inRepo (Git.Ref.sha tomerge)
|
||||||
<*> inRepo Git.Branch.current
|
<*> inRepo Git.Branch.current
|
||||||
where
|
where
|
||||||
|
@ -232,18 +232,19 @@ updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $ do
|
||||||
propigateAdjustedCommits' origbranch (adj, currbranch) commitsprevented
|
propigateAdjustedCommits' origbranch (adj, currbranch) commitsprevented
|
||||||
adjustedtomerge <- adjust adj mergesha
|
adjustedtomerge <- adjust adj mergesha
|
||||||
ifM (inRepo $ Git.Branch.changed currbranch adjustedtomerge)
|
ifM (inRepo $ Git.Branch.changed currbranch adjustedtomerge)
|
||||||
( do
|
( return $ do
|
||||||
liftIO $ Git.LockFile.closeLock commitsprevented
|
-- Run after commit lock is dropped.
|
||||||
ifM (autoMergeFrom adjustedtomerge (Just currbranch) commitmode)
|
ifM (autoMergeFrom adjustedtomerge (Just currbranch) commitmode)
|
||||||
( preventCommits $ \commitsprevented' ->
|
( preventCommits $ \commitsprevented' ->
|
||||||
recommit commitsprevented' currbranch mergesha =<< catCommit currbranch
|
recommit commitsprevented' currbranch mergesha =<< catCommit currbranch
|
||||||
, return False
|
, 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
|
{- Once a merge commit has been made, re-do it, removing
|
||||||
- the old version of the adjusted branch as a parent, and
|
- the old version of the adjusted branch as a parent, and
|
||||||
- making the only parent be the branch that was merged in.
|
- making the only parent be the branch that was merged in.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue