summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 1bf6e58b9db..cf269061ebe 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1013,17 +1013,14 @@ class Repository
branch_commit = commit(branch_name)
root_ref_commit = commit(root_ref)
- if branch_commit && !same_head?(branch_commit.id, root_ref_commit.id)
- is_ancestor?(branch_commit.id, root_ref_commit.id)
+ if branch_commit
+ same_head = branch_commit.id == root_ref_commit.id
+ !same_head && is_ancestor?(branch_commit.id, root_ref_commit.id)
else
nil
end
end
- def same_head?(first_commit_id, second_commit_id)
- first_commit_id == second_commit_id
- end
-
def merge_base(first_commit_id, second_commit_id)
first_commit_id = commit(first_commit_id).try(:id) || first_commit_id
second_commit_id = commit(second_commit_id).try(:id) || second_commit_id