Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
153085a9
Commit
153085a9
authored
Nov 11, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Repository#is_ancestor? convenience method.
parent
a0519818
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
app/models/repository.rb
app/models/repository.rb
+6
-1
No files found.
app/models/repository.rb
View file @
153085a9
...
...
@@ -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
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment