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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
88f9ed3d
Commit
88f9ed3d
authored
9 years ago
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move finding of contributing file from tree to repository.
parent
dbd347bf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
app/models/repository.rb
app/models/repository.rb
+6
-1
app/models/tree.rb
app/models/tree.rb
+1
-6
No files found.
app/models/repository.rb
View file @
88f9ed3d
...
...
@@ -197,7 +197,12 @@ class Repository
end
def
contribution_guide
cache
.
fetch
(
:contribution_guide
)
{
tree
(
:head
).
contribution_guide
}
cache
.
fetch
(
:contribution_guide
)
do
tree
(
:head
).
blobs
.
find
do
|
file
|
file
.
contributing?
end
end
end
end
def
head_commit
...
...
This diff is collapsed.
Click to expand it.
app/models/tree.rb
View file @
88f9ed3d
class
Tree
include
Gitlab
::
MarkdownHelper
attr_accessor
:entries
,
:readme
,
:contribution_guide
attr_accessor
:entries
,
:readme
def
initialize
(
repository
,
sha
,
path
=
'/'
)
path
=
'/'
if
path
.
blank?
...
...
@@ -28,11 +28,6 @@ class Tree
readme_path
=
path
==
'/'
?
readme_tree
.
name
:
File
.
join
(
path
,
readme_tree
.
name
)
@readme
=
Gitlab
::
Git
::
Blob
.
find
(
git_repo
,
sha
,
readme_path
)
end
if
contribution_tree
=
@entries
.
find
(
&
:contributing?
)
contribution_path
=
path
==
'/'
?
contribution_tree
.
name
:
File
.
join
(
path
,
contribution_tree
.
name
)
@contribution_guide
=
Gitlab
::
Git
::
Blob
.
find
(
git_repo
,
sha
,
contribution_path
)
end
end
def
trees
...
...
This diff is collapsed.
Click to expand it.
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