summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiyev@gmail.com>2015-12-08 18:51:07 -0500
committerElvin Efendi <elvin.efendiyev@gmail.com>2015-12-08 18:51:07 -0500
commit0362787087a84d3fd8dfd0b38a657d73947a8753 (patch)
tree322868ba1cfb4953452033813374b32711d0faf5 /lib/oxidized
parent1df0f01c6166e1ef1653c90818aaa47118af4700 (diff)
parentb6a9c3ae528de0b577ff3f7c601b4ca5b641185d (diff)
Merge pull request #10 from Shopify/detect-conflict
Detect conflict
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/hook/githubrepo.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb
index 83e1078..25b2cd0 100644
--- a/lib/oxidized/hook/githubrepo.rb
+++ b/lib/oxidized/hook/githubrepo.rb
@@ -16,12 +16,14 @@ class GithubRepo < Oxidized::Hook
end
def fetch_and_merge_remote(repo, credentials)
- their_branch = repo.branches["origin/master"] or return
-
repo.fetch('origin', [repo.head.name], credentials: credentials)
+ their_branch = repo.branches["origin/master"] or return
+
merge_index = repo.merge_commits(repo.head.target_id, their_branch.target_id)
+ log("Conflicts detected", :warn) if merge_index.conflicts?
+
Rugged::Commit.create(repo, {
parents: [repo.head.target, their_branch.target],
tree: merge_index.write_tree(repo),