minor cleanups
mergeFrom is never called on branches that don't exist anymore
This commit is contained in:
parent
015a497914
commit
79231bcff0
1 changed files with 9 additions and 15 deletions
|
@ -86,7 +86,7 @@ mergeLocal branch = go =<< needmerge
|
|||
go False = stop
|
||||
go True = do
|
||||
showStart "merge" $ Git.Ref.describe syncbranch
|
||||
next $ next $ mergeFromIfExists syncbranch
|
||||
next $ next $ mergeFrom syncbranch
|
||||
|
||||
pushLocal :: Git.Ref -> CommandStart
|
||||
pushLocal branch = go =<< inRepo (Git.Ref.exists syncbranch)
|
||||
|
@ -106,17 +106,10 @@ updateBranch syncbranch =
|
|||
, Param $ show $ Git.Ref.base syncbranch
|
||||
]
|
||||
|
||||
mergeFromIfExists :: Git.Ref -> CommandCleanup
|
||||
mergeFromIfExists branch = go =<< inRepo (Git.Ref.exists branch)
|
||||
where
|
||||
go True = do
|
||||
mergeFrom :: Git.Ref -> CommandCleanup
|
||||
mergeFrom branch = do
|
||||
showOutput
|
||||
inRepo $ Git.Command.runBool "merge"
|
||||
[Param (show branch)]
|
||||
go False = do
|
||||
showNote $ Git.Ref.describe branch ++
|
||||
" does not exist, not merging"
|
||||
return False
|
||||
inRepo $ Git.Command.runBool "merge" [Param $ show branch]
|
||||
|
||||
pullRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
||||
pullRemote remote branch = do
|
||||
|
@ -134,14 +127,15 @@ pullRemote remote branch = do
|
|||
- were committed, while the synced/master may have changes that some
|
||||
- other remote synced to this remote. So, merge them both. -}
|
||||
mergeRemote :: Remote.Remote Annex -> Git.Ref -> CommandCleanup
|
||||
mergeRemote remote branch = all (== True) <$> mapM go [branch, syncBranch branch]
|
||||
mergeRemote remote branch = all id <$> mapM go [branch, syncBranch branch]
|
||||
where
|
||||
go b = do
|
||||
e <- inRepo $ Git.Branch.changed branch b
|
||||
if e
|
||||
then mergeFromIfExists $ remotebranch b
|
||||
then mergeFrom $ remotebranch b
|
||||
else return True
|
||||
remotebranch = Git.Ref.under $ "refs/remotes/" ++ Remote.name remote
|
||||
remotebranch = Git.Ref.under $
|
||||
"refs/remotes/" ++ Remote.name remote
|
||||
|
||||
pushRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
||||
pushRemote remote branch = go =<< needpush
|
||||
|
|
Loading…
Reference in a new issue