check that synced/master exists before trying to use it
and a nice error message if syncing is not set up yet
This commit is contained in:
parent
f2fa29bf3b
commit
56488e807b
1 changed files with 8 additions and 3 deletions
|
@ -70,9 +70,13 @@ commit = do
|
||||||
return True
|
return True
|
||||||
|
|
||||||
mergeLocal :: Git.Ref -> CommandStart
|
mergeLocal :: Git.Ref -> CommandStart
|
||||||
mergeLocal branch = go =<< inRepo (Git.Branch.changed branch mergebranch)
|
mergeLocal branch = go =<< needmerge
|
||||||
where
|
where
|
||||||
mergebranch = Git.Ref.under "refs/heads/synced" branch
|
mergebranch = Git.Ref.under "refs/heads/synced" branch
|
||||||
|
needmerge = do
|
||||||
|
unlessM (inRepo $ Git.Ref.exists mergebranch) $
|
||||||
|
error $ Git.Ref.describe mergebranch ++ " does not exist; create it to enable sync"
|
||||||
|
inRepo $ Git.Branch.changed branch mergebranch
|
||||||
go False = stop
|
go False = stop
|
||||||
go True = do
|
go True = do
|
||||||
showStart "merge" $ Git.Ref.describe mergebranch
|
showStart "merge" $ Git.Ref.describe mergebranch
|
||||||
|
@ -109,7 +113,8 @@ pullRemote remote branch = do
|
||||||
next $ do
|
next $ do
|
||||||
checkRemote remote
|
checkRemote remote
|
||||||
showOutput
|
showOutput
|
||||||
fetched <- inRepo $ Git.Command.runBool "fetch" [Param (Remote.name remote)]
|
fetched <- inRepo $ Git.Command.runBool "fetch"
|
||||||
|
[Param $ Remote.name remote]
|
||||||
if fetched
|
if fetched
|
||||||
then next $ mergeRemote remote branch
|
then next $ mergeRemote remote branch
|
||||||
else stop
|
else stop
|
||||||
|
@ -123,7 +128,7 @@ pushRemote remote branch syncbranch = go =<< newer
|
||||||
where
|
where
|
||||||
newer = inRepo $ Git.Branch.changed syncbranchRemote syncbranch
|
newer = inRepo $ Git.Branch.changed syncbranchRemote syncbranch
|
||||||
go False = stop
|
go False = stop
|
||||||
go True = do
|
go True = do
|
||||||
showStart "push" (Remote.name remote)
|
showStart "push" (Remote.name remote)
|
||||||
ex <- inRepo $ Git.Ref.exists syncbranchRemote
|
ex <- inRepo $ Git.Ref.exists syncbranchRemote
|
||||||
next $ next $ do
|
next $ next $ do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue