diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 06613919..c77c9837 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -154,17 +154,14 @@ class PullRequestsController < ApplicationController forked_source_project = Project.find(target_project) user_name_target = forked_source_project.owner.try(:login) git_target_tree = '--git-dir=/home/git/repositories/' + user_name_target + '/' + identifier + '.git' - git_sourse_commit_id = @g.get_branch_commit_id(@project.gpid, git_source_tree, source_branch) - git_target_commit_id = @g.get_branch_commit_id(forked_source_project.gpid, git_target_tree, target_branch) + + git_sourse_commit_id = @g.commis(@project.gpid, :ref => source_branch).first.try(:id) + git_target_commit_id = @g.commis(forked_source_project.gpid, :ref => target_branch).first.try(:id) else - git_sourse_commit_id = @g.get_branch_commit_id(@project.gpid, git_source_tree, source_branch) - git_target_commit_id = @g.get_branch_commit_id(@project.gpid, git_source_tree, target_branch) + git_sourse_commit_id = @g.commis(@project.gpid, :ref => source_branch).first.try(:id) + git_target_commit_id = @g.commis(@project.gpid, :ref => target_branch).first.try(:id) end - Rails.logger.info("=========git_sourse_commit_id========#{git_sourse_commit_id.to_json}") - Rails.logger.info("=========git_target_commit_id========#{git_target_commit_id.to_json}") - Rails.logger.info("=========git_sourse_commit_id========#{git_sourse_commit_id.try(:id)}") - Rails.logger.info("=========git_target_commit_id========#{git_target_commit_id.try(:id)}") - status = (git_sourse_commit_id.try(:commit_id) == git_target_commit_id.try(:commit_id) ? false : true) + status = (git_sourse_commit_id == git_target_commit_id ? false : true) end # @project_menu_type 为了控制base顶部导航