can't checkout adjusted branch while index is still locked

There's a race here, but entering an adjusted branch for the first time is
not something to do when a commit is being made at the same time. Although,
may want to prevent the assistant from committing while entering the
adjusted branch.
This commit is contained in:
Joey Hess 2016-03-03 14:17:37 -04:00
parent 6024108ab2
commit 91f37673df
Failed to extract signature
2 changed files with 11 additions and 2 deletions

View file

@ -91,8 +91,8 @@ originalBranch = fmap fromAdjustedBranch <$> inRepo Git.Branch.current
enterAdjustedBranch :: Adjustment -> Annex ()
enterAdjustedBranch adj = go =<< originalBranch
where
go (Just origbranch) = preventCommits $ do
adjbranch <- adjustBranch adj origbranch
go (Just origbranch) = do
adjbranch <- preventCommits $ adjustBranch adj origbranch
inRepo $ Git.Command.run
[ Param "checkout"
, Param $ fromRef $ Git.Ref.base $ adjbranch

View file

@ -342,3 +342,12 @@ like this, at its most simple:
-- Generate a version of the commit made on the filter branch
-- with the filtering of modified files reversed.
unfilteredCommit :: Filter -> Git.Commit -> Git.Commit
## TODOs
* Need a better command-line interface than `git annex adjust`,
that allows picking adjustments.
* Interface in webapp to enable adjustments.
* Entering an adjusted branch can race with commits to the current branch,
and so the assistant should not be running, or at least should have
commits disabled when entering it.