add one more check for merging pull requests
This commit is contained in:
parent
96698b4195
commit
a4522bc3c7
|
@ -78,12 +78,17 @@ class PullRequest < ActiveRecord::Base
|
||||||
def merge!(who)
|
def merge!(who)
|
||||||
return false unless can_merging?
|
return false unless can_merging?
|
||||||
Dir.chdir(path) do
|
Dir.chdir(path) do
|
||||||
|
old_commit = to_project.repo.commits(to_ref).first
|
||||||
commit = repo.commits(to_ref).first
|
commit = repo.commits(to_ref).first
|
||||||
system "git config user.name \"#{who.uname}\" && git config user.email \"#{who.email}\""
|
system "git config user.name \"#{who.uname}\" && git config user.email \"#{who.email}\""
|
||||||
res = merge
|
res = merge
|
||||||
if commit.id != repo.commits(to_ref).first.id
|
if commit.id != repo.commits(to_ref).first.id
|
||||||
system("export GL_ID=user-#{who.id} && git push origin HEAD")
|
res2 = %x(export GL_ID=user-#{who.id} && git push origin HEAD)
|
||||||
system("git reset --hard HEAD^") # for diff maybe FIXME
|
system("git reset --hard HEAD^") # for diff maybe FIXME
|
||||||
|
|
||||||
|
if old_commit.id == to_project.repo.commits(to_ref).first.id
|
||||||
|
raise "merge result pull_request #{id}: #{res}; #{res2}"
|
||||||
|
end
|
||||||
set_user_and_time who
|
set_user_and_time who
|
||||||
merging
|
merging
|
||||||
else # Try to catch no merge errors
|
else # Try to catch no merge errors
|
||||||
|
|
Loading…
Reference in New Issue