Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab FOSS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab FOSS
Commits
d3ddc69b
Commit
d3ddc69b
authored
7 years ago
by
Jacob Vosmaer
Browse files
Options
Downloads
Patches
Plain Diff
Add rugged_is_ancestor method
parent
1a0e176b
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/repository.rb
+1
-1
1 addition, 1 deletion
app/models/repository.rb
lib/gitlab/git/repository.rb
+7
-0
7 additions, 0 deletions
lib/gitlab/git/repository.rb
with
8 additions
and
1 deletion
app/models/repository.rb
+
1
−
1
View file @
d3ddc69b
...
...
@@ -944,7 +944,7 @@ def is_ancestor?(ancestor_id, descendant_id)
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
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/git/repository.rb
+
7
−
0
View file @
d3ddc69b
...
...
@@ -353,6 +353,13 @@ def merge_base_commit(from, to)
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment