summaryrefslogtreecommitdiff
path: root/Command/Sync.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 /Command/Sync.hs
parent7478872a095ef9b05ce9124f9b1f5be2773065a8 (diff)
fix crashes when run in a git repo that has been initted but has no master branch yet
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r--Command/Sync.hs9
1 files changed, 1 insertions, 8 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index dfaed5949..7bf3048de 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -6,8 +6,6 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE BangPatterns #-}
-
module Command.Sync where
import Common.Annex
@@ -39,7 +37,7 @@ def = [command "sync" (paramOptional (paramRepeating paramRemote))
-- syncing involves several operations, any of which can independently fail
seek :: CommandSeek
seek rs = do
- branch <- currentBranch
+ branch <- fromMaybe nobranch <$> inRepo Git.Branch.current
remotes <- syncRemotes rs
return $ concat
[ [ commit ]
@@ -49,11 +47,6 @@ seek rs = do
, [ pushLocal branch ]
, [ pushRemote remote branch | remote <- remotes ]
]
-
-currentBranch :: Annex Git.Ref
-currentBranch = do
- !branch <- fromMaybe nobranch <$> inRepo Git.Branch.current
- return branch
where
nobranch = error "no branch is checked out"