Commit c937d06c authored by Zevs's avatar Zevs

Task#755 auto-merge don`t work correctly.

parent 903f9491
...@@ -8,14 +8,16 @@ class GitlabMerge ...@@ -8,14 +8,16 @@ class GitlabMerge
end end
def can_be_merged? def can_be_merged?
result = false
process do |repo, output| process do |repo, output|
!(output =~ /Automatic merge failed/) result = !(output =~ /CONFLICT/)
end end
result
end end
def merge def merge
process do |repo, output| process do |repo, output|
if output =~ /Automatic merge failed/ if output =~ /CONFLICT/
false false
else else
repo.git.push({}, "origin", merge_request.target_branch) repo.git.push({}, "origin", merge_request.target_branch)
...@@ -39,6 +41,7 @@ class GitlabMerge ...@@ -39,6 +41,7 @@ class GitlabMerge
Dir.chdir(project.satellite.path) do Dir.chdir(project.satellite.path) do
merge_repo = Grit::Repo.new('.') merge_repo = Grit::Repo.new('.')
merge_repo.git.sh "git reset --hard"
merge_repo.git.sh "git fetch origin" merge_repo.git.sh "git fetch origin"
merge_repo.git.sh "git config user.name \"#{user.name}\"" merge_repo.git.sh "git config user.name \"#{user.name}\""
merge_repo.git.sh "git config user.email \"#{user.email}\"" merge_repo.git.sh "git config user.email \"#{user.email}\""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment