Commit 30413fd2 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'rugged-is-ancestor' into 'master'

Add rugged_is_ancestor method

See merge request !13232
parents c955c3d5 d3ddc69b
...@@ -944,7 +944,7 @@ class Repository ...@@ -944,7 +944,7 @@ class Repository
if is_enabled if is_enabled
raw_repository.is_ancestor?(ancestor_id, descendant_id) raw_repository.is_ancestor?(ancestor_id, descendant_id)
else else
merge_base_commit(ancestor_id, descendant_id) == ancestor_id rugged_is_ancestor?(ancestor_id, descendant_id)
end end
end end
end end
......
...@@ -353,6 +353,13 @@ module Gitlab ...@@ -353,6 +353,13 @@ module Gitlab
rugged.merge_base(from, to) rugged.merge_base(from, to)
end 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 # Returns true is +from+ is direct ancestor to +to+, otherwise false
def is_ancestor?(from, to) def is_ancestor?(from, to)
gitaly_commit_client.is_ancestor(from, to) gitaly_commit_client.is_ancestor(from, to)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment