diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index caa84707cfb..841861293c8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -119,6 +119,8 @@ v 8.12.1 - Fix issue with search filter labels not displaying v 8.12.0 +v 8.12.0 (unreleased) + - Removes inconsistency regarding tagging immediatelly as merged once you create a new branch. !6408 - Update the rouge gem to 2.0.6, which adds highlighting support for JSX, Prometheus, and others. !6251 - Only check :can_resolve permission if the note is resolvable - Bump fog-aws to v0.11.0 to support ap-south-1 region diff --git a/app/models/repository.rb b/app/models/repository.rb index bf59b74495b..1bf6e58b9db 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1013,13 +1013,17 @@ class Repository branch_commit = commit(branch_name) root_ref_commit = commit(root_ref) - if branch_commit + if branch_commit && !same_head?(branch_commit.id, root_ref_commit.id) 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 |