diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-08-01 17:24:37 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-08-01 17:24:37 +0200 |
commit | d3ddc69b54a70fbd2332a21d18babd55f240e5a6 (patch) | |
tree | 950635b11548983cb1b82103173dc02b1b259c59 | |
parent | 1a0e176ba1a55005ee04d187e4b20127603373d8 (diff) | |
download | gitlab-ce-d3ddc69b54a70fbd2332a21d18babd55f240e5a6.tar.gz |
Add rugged_is_ancestor method
-rw-r--r-- | app/models/repository.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 7ea9f1459a0..4e9fe759fdc 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -944,7 +944,7 @@ class Repository if is_enabled raw_repository.is_ancestor?(ancestor_id, descendant_id) else - merge_base_commit(ancestor_id, descendant_id) == ancestor_id + rugged_is_ancestor?(ancestor_id, descendant_id) end end end diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 88529ba2c47..70d793f8e4a 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -353,6 +353,13 @@ module Gitlab rugged.merge_base(from, to) end + # Gitaly note: JV: check gitlab-ee before removing this method. + def rugged_is_ancestor?(ancestor_id, descendant_id) + return false if ancestor_id.nil? || descendant_id.nil? + + merge_base_commit(ancestor_id, descendant_id) == ancestor_id + end + # Returns true is +from+ is direct ancestor to +to+, otherwise false def is_ancestor?(from, to) gitaly_commit_client.is_ancestor(from, to) |