summaryrefslogtreecommitdiff
path: root/Assistant/Threads/Pusher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-05 15:45:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-05 15:53:47 -0400
commit34fc0d358e53e4c615b1fe6fb80374a5302ccf1c (patch)
tree4d69aacaa9cc7f36c329c992728e8dd75899fda8 /Assistant/Threads/Pusher.hs
parent7478872a095ef9b05ce9124f9b1f5be2773065a8 (diff)
fix crashes when run in a git repo that has been initted but has no master branch yet
Diffstat (limited to 'Assistant/Threads/Pusher.hs')
-rw-r--r--Assistant/Threads/Pusher.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Assistant/Threads/Pusher.hs b/Assistant/Threads/Pusher.hs
index ab0274db1..5e110b77d 100644
--- a/Assistant/Threads/Pusher.hs
+++ b/Assistant/Threads/Pusher.hs
@@ -17,6 +17,7 @@ import Assistant.DaemonStatus
import qualified Command.Sync
import Utility.ThreadScheduler
import Utility.Parallel
+import qualified Git.Branch
import Data.Time.Clock
import qualified Data.Map as M
@@ -84,10 +85,11 @@ shouldPush _now commits
pushToRemotes :: ThreadName -> UTCTime -> ThreadState -> (Maybe FailedPushMap) -> [Remote] -> IO Bool
pushToRemotes threadname now st mpushmap remotes = do
(g, branch) <- runThreadState st $
- (,) <$> fromRepo id <*> Command.Sync.currentBranch
+ (,) <$> fromRepo id <*> inRepo Git.Branch.current
go True branch g remotes
where
- go shouldretry branch g rs = do
+ go _ Nothing _ _ = return True -- no branch, so nothing to do
+ go shouldretry (Just branch) g rs = do
debug threadname
[ "pushing to"
, show rs
@@ -117,4 +119,4 @@ pushToRemotes threadname now st mpushmap remotes = do
retry branch g rs = do
debug threadname [ "trying manual pull to resolve failed pushes" ]
runThreadState st $ manualPull branch rs
- go False branch g rs
+ go False (Just branch) g rs