Merge pull request #9 from abf/rosa-build:fix_pull_updating_code\r\n Fix update code on pull request

This commit is contained in:
avokhmin 2013-03-07 17:02:20 +04:00
commit dd942703f0
2 changed files with 4 additions and 2 deletions

View File

@ -152,7 +152,7 @@ class Projects::PullRequestsController < Projects::BaseController
@pull.issue.body = pull_params[:issue_attributes][:body].presence
end
@pull.from_project = @project
@pull.to_ref = (pull_params[:to_ref].presence if pull_params) || @pull.to_project.default_head(params[:treeish])
@pull.to_ref = (pull_params[:to_ref].presence if pull_params) || @pull.to_project.default_head
@pull.from_ref = params[:treeish].presence || (pull_params[:from_ref].presence if pull_params) || @pull.from_project.default_head(params[:treeish])
@pull.from_project_owner_uname = @pull.from_project.owner.uname
@pull.from_project_name = @pull.from_project.name

View File

@ -177,7 +177,9 @@ class PullRequest < ActiveRecord::Base
Dir.chdir(path) do
system 'git', 'tag', '-d', from_ref, to_ref
system 'git fetch --tags'
system 'git fetch --tags -all'
system 'git fetch --all'
tags, head = repo.tags.map(&:name), to_project == from_project ? 'origin' : 'head'
system 'git', 'checkout', to_ref
unless tags.include? to_ref