Add rugged_is_ancestor method

This commit is contained in:
Jacob Vosmaer 2017-08-01 17:24:37 +02:00
parent 1a0e176ba1
commit d3ddc69b54
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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)