diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-09-19 14:31:51 +0300 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-10-10 01:20:45 +0300 |
commit | 2de8fc3e13b64dfc50e872486aad0c33b35df8a6 (patch) | |
tree | 6dbb9f9f04e352eeccaa8548ed99bb37c209e3e9 /app/models/repository.rb | |
parent | 4e963fed42ad518caa7353d361a38a1250c99c41 (diff) |
removes inconsistency regarding tagging immediately as merged once you create a branch using new branch button and adds changelog entry
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |