diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index c961ead4d..08dabf8e2 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -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 diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index ae549e93e..7f3478620 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -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