summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-05 13:40:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-05 13:40:49 -0400
commit348dec0551c5dfdf7734a4adf0196d576593ae28 (patch)
tree585932c41eebeb40b8ad3ded8a54de159dff1024 /Command
parent492691812af4cab81c21ae98cd47f97dbf4cda76 (diff)
sync: Fix an edge case where syncing in a bare repository would try to merge and so fail.
In the case where a remote of the bare repo has a fetch = configuration, refs/remotes/origin/master will exist, and so the merge code path tried to run in the bare repo.
Diffstat (limited to 'Command')
-rw-r--r--Command/Sync.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 28d7c69c5..2299306ed 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -227,12 +227,15 @@ pullRemote remote branch = do
- while the synced/master may have changes that some
- other remote synced to this remote. So, merge them both. -}
mergeRemote :: Remote -> Maybe Git.Ref -> CommandCleanup
-mergeRemote remote b = case b of
- Nothing -> do
- branch <- inRepo Git.Branch.currentUnsafe
- and <$> mapM (merge Nothing) (branchlist branch)
- Just thisbranch ->
- and <$> (mapM (merge (Just thisbranch)) =<< tomerge (branchlist b))
+mergeRemote remote b = ifM isBareRepo
+ ( return True
+ , case b of
+ Nothing -> do
+ branch <- inRepo Git.Branch.currentUnsafe
+ and <$> mapM (merge Nothing) (branchlist branch)
+ Just thisbranch ->
+ and <$> (mapM (merge (Just thisbranch)) =<< tomerge (branchlist b))
+ )
where
merge thisbranch br = autoMergeFrom (remoteBranch remote br) thisbranch Git.Branch.ManualCommit
tomerge = filterM (changed remote)