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 False = stop
|
||||||
go True = do
|
go True = do
|
||||||
showStart "merge" $ Git.Ref.describe syncbranch
|
showStart "merge" $ Git.Ref.describe syncbranch
|
||||||
next $ next $ mergeFromIfExists syncbranch
|
next $ next $ mergeFrom syncbranch
|
||||||
|
|
||||||
pushLocal :: Git.Ref -> CommandStart
|
pushLocal :: Git.Ref -> CommandStart
|
||||||
pushLocal branch = go =<< inRepo (Git.Ref.exists syncbranch)
|
pushLocal branch = go =<< inRepo (Git.Ref.exists syncbranch)
|
||||||
|
@ -106,17 +106,10 @@ updateBranch syncbranch =
|
||||||
, Param $ show $ Git.Ref.base syncbranch
|
, Param $ show $ Git.Ref.base syncbranch
|
||||||
]
|
]
|
||||||
|
|
||||||
mergeFromIfExists :: Git.Ref -> CommandCleanup
|
mergeFrom :: Git.Ref -> CommandCleanup
|
||||||
mergeFromIfExists branch = go =<< inRepo (Git.Ref.exists branch)
|
mergeFrom branch = do
|
||||||
where
|
|
||||||
go True = do
|
|
||||||
showOutput
|
showOutput
|
||||||
inRepo $ Git.Command.runBool "merge"
|
inRepo $ Git.Command.runBool "merge" [Param $ show branch]
|
||||||
[Param (show branch)]
|
|
||||||
go False = do
|
|
||||||
showNote $ Git.Ref.describe branch ++
|
|
||||||
" does not exist, not merging"
|
|
||||||
return False
|
|
||||||
|
|
||||||
pullRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
pullRemote :: Remote.Remote Annex -> Git.Ref -> CommandStart
|
||||||
pullRemote remote branch = do
|
pullRemote remote branch = do
|
||||||
|
@ -134,14 +127,15 @@ pullRemote remote branch = do
|
||||||
- were committed, while the synced/master may have changes that some
|
- were committed, while the synced/master may have changes that some
|
||||||
- other remote synced to this remote. So, merge them both. -}
|
- other remote synced to this remote. So, merge them both. -}
|
||||||
mergeRemote :: Remote.Remote Annex -> Git.Ref -> CommandCleanup
|
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
|
where
|
||||||
go b = do
|
go b = do
|
||||||
e <- inRepo $ Git.Branch.changed branch b
|
e <- inRepo $ Git.Branch.changed branch b
|
||||||
if e
|
if e
|
||||||
then mergeFromIfExists $ remotebranch b
|
then mergeFrom $ remotebranch b
|
||||||
else return True
|
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.Remote Annex -> Git.Ref -> CommandStart
|
||||||
pushRemote remote branch = go =<< needpush
|
pushRemote remote branch = go =<< needpush
|
||||||
|
|
Loading…
Reference in a new issue