add reflog messages

This commit is contained in:
Joey Hess 2016-03-31 12:27:48 -04:00
parent 02ce75c87d
commit a585731935
Failed to extract signature
3 changed files with 20 additions and 11 deletions

View file

@ -167,7 +167,7 @@ adjustToCrippledFileSystem = do
adjustBranch :: Adjustment -> OrigBranch -> Annex AdjBranch adjustBranch :: Adjustment -> OrigBranch -> Annex AdjBranch
adjustBranch adj origbranch = do adjustBranch adj origbranch = do
sha <- adjust adj origbranch sha <- adjust adj origbranch
inRepo $ Git.Branch.update adjbranch sha inRepo $ Git.Branch.update "entering adjusted branch" adjbranch sha
return adjbranch return adjbranch
where where
adjbranch = originalToAdjusted origbranch adj adjbranch = originalToAdjusted origbranch adj
@ -254,7 +254,7 @@ updateAdjustedBranch tomerge (origbranch, adj) commitmode = catchBoolIO $
-} -}
recommit commitsprevented currbranch parent (Just commit) = do recommit commitsprevented currbranch parent (Just commit) = do
commitsha <- commitAdjustedTree (commitTree commit) parent commitsha <- commitAdjustedTree (commitTree commit) parent
inRepo $ Git.Branch.update currbranch commitsha inRepo $ Git.Branch.update "merging into adjusted branch" currbranch commitsha
propigateAdjustedCommits' origbranch (adj, currbranch) commitsprevented propigateAdjustedCommits' origbranch (adj, currbranch) commitsprevented
return True return True
recommit _ _ _ Nothing = return False recommit _ _ _ Nothing = return False
@ -292,7 +292,7 @@ propigateAdjustedCommits' origbranch (adj, currbranch) _commitsprevented = do
-- in order made. -- in order made.
[Param "--reverse"] [Param "--reverse"]
go parent _ [] = do go parent _ [] = do
inRepo $ Git.Branch.update origbranch parent inRepo $ Git.Branch.update "updating adjusted branch" origbranch parent
return (Right parent) return (Right parent)
go parent pastadjcommit (sha:l) = do go parent pastadjcommit (sha:l) = do
mc <- catCommit sha mc <- catCommit sha
@ -311,7 +311,7 @@ propigateAdjustedCommits' origbranch (adj, currbranch) _commitsprevented = do
-- and reparent it on top of the new -- and reparent it on top of the new
-- version of the origbranch. -- version of the origbranch.
commitAdjustedTree (commitTree currcommit) newparent commitAdjustedTree (commitTree currcommit) newparent
>>= inRepo . Git.Branch.update currbranch >>= inRepo . Git.Branch.update "rebasing adjusted branch on top of updated original branch" currbranch
{- Reverses an adjusted commit, and commit on top of the provided newparent, {- Reverses an adjusted commit, and commit on top of the provided newparent,
- yielding a commit sha. - yielding a commit sha.

View file

@ -225,7 +225,7 @@ mergeDirectCommit allowff old branch commitmode = do
let merge_msg = d </> "MERGE_MSG" let merge_msg = d </> "MERGE_MSG"
let merge_mode = d </> "MERGE_MODE" let merge_mode = d </> "MERGE_MODE"
ifM (pure allowff <&&> canff) ifM (pure allowff <&&> canff)
( inRepo $ Git.Branch.update Git.Ref.headRef branch -- fast forward ( inRepo $ Git.Branch.update "merge" Git.Ref.headRef branch -- fast forward
, do , do
msg <- liftIO $ msg <- liftIO $
catchDefaultIO ("merge " ++ fromRef branch) $ catchDefaultIO ("merge " ++ fromRef branch) $
@ -462,7 +462,7 @@ switchHEAD = maybe noop switch =<< inRepo Git.Branch.currentUnsafe
where where
switch orighead = do switch orighead = do
let newhead = directBranch orighead let newhead = directBranch orighead
maybe noop (inRepo . Git.Branch.update newhead) maybe noop (inRepo . Git.Branch.update "entering direct mode" newhead)
=<< inRepo (Git.Ref.sha orighead) =<< inRepo (Git.Ref.sha orighead)
inRepo $ Git.Branch.checkout newhead inRepo $ Git.Branch.checkout newhead
@ -475,7 +475,7 @@ switchHEADBack = maybe noop switch =<< inRepo Git.Branch.currentUnsafe
case v of case v of
Just headsha Just headsha
| orighead /= currhead -> do | orighead /= currhead -> do
inRepo $ Git.Branch.update orighead headsha inRepo $ Git.Branch.update "leaving direct mode" orighead headsha
inRepo $ Git.Branch.checkout orighead inRepo $ Git.Branch.checkout orighead
inRepo $ Git.Branch.delete currhead inRepo $ Git.Branch.delete currhead
_ -> inRepo $ Git.Branch.checkout orighead _ -> inRepo $ Git.Branch.checkout orighead

View file

@ -100,7 +100,7 @@ fastForward branch (first:rest) repo =
where where
no_ff = return False no_ff = return False
do_ff to = do do_ff to = do
update branch to repo update' branch to repo
return True return True
findbest c [] = return $ Just c findbest c [] = return $ Just c
findbest c (r:rs) findbest c (r:rs)
@ -155,7 +155,7 @@ commit commitmode allowempty message branch parentrefs repo = do
ifM (cancommit tree) ifM (cancommit tree)
( do ( do
sha <- commitTree commitmode message parentrefs tree repo sha <- commitTree commitmode message parentrefs tree repo
update branch sha repo update' branch sha repo
return $ Just sha return $ Just sha
, return Nothing , return Nothing
) )
@ -185,8 +185,17 @@ forcePush :: String -> String
forcePush b = "+" ++ b forcePush b = "+" ++ b
{- Updates a branch (or other ref) to a new Sha. -} {- Updates a branch (or other ref) to a new Sha. -}
update :: Branch -> Sha -> Repo -> IO () update :: String -> Branch -> Sha -> Repo -> IO ()
update branch sha = run update message branch sha = run
[ Param "update-ref"
, Param "-m"
, Param message
, Param $ fromRef branch
, Param $ fromRef sha
]
update' :: Branch -> Sha -> Repo -> IO ()
update' branch sha = run
[ Param "update-ref" [ Param "update-ref"
, Param $ fromRef branch , Param $ fromRef branch
, Param $ fromRef sha , Param $ fromRef sha