Commit 153085a9 authored by Douwe Maan's avatar Douwe Maan

Add Repository#is_ancestor? convenience method.

parent a0519818
......@@ -484,7 +484,7 @@ class Repository
root_ref_commit = commit(root_ref)
if branch_commit
rugged.merge_base(root_ref_commit.id, branch_commit.id) == branch_commit.id
is_ancestor?(branch_commit.id, root_ref_commit.id)
else
nil
end
......@@ -494,6 +494,11 @@ class Repository
rugged.merge_base(first_commit_id, second_commit_id)
end
def is_ancestor?(ancestor_id, descendant_id)
merge_base(ancestor_id, descendant_id) == ancestor_id
end
def search_files(query, ref)
offset = 2
args = %W(#{Gitlab.config.git.bin_path} grep -i -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
......
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