summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-08-02 09:57:06 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-08-02 09:57:06 +0000
commit30413fd2fffb42424d83c68814a2e8e70bf94671 (patch)
tree0360d8f7629b129f516872c0c9a51bbf313217fb /lib
parentc955c3d5bf43b4043a8fad04daa498b9f529cf98 (diff)
parentd3ddc69b54a70fbd2332a21d18babd55f240e5a6 (diff)
downloadgitlab-ce-30413fd2fffb42424d83c68814a2e8e70bf94671.tar.gz
Merge branch 'rugged-is-ancestor' into 'master'
Add rugged_is_ancestor method See merge request !13232
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb7
1 files changed, 7 insertions, 0 deletions
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)