summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-09-19 12:31:51 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-10-09 23:20:45 +0100
commit2de8fc3e13b64dfc50e872486aad0c33b35df8a6 (patch)
tree6dbb9f9f04e352eeccaa8548ed99bb37c209e3e9
parent4e963fed42ad518caa7353d361a38a1250c99c41 (diff)
downloadgitlab-ce-2de8fc3e13b64dfc50e872486aad0c33b35df8a6.tar.gz
removes inconsistency regarding tagging immediately as merged once you create a branch using new branch button and adds changelog entry
-rw-r--r--CHANGELOG2
-rw-r--r--app/models/repository.rb6
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