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
Tatuya Kamada
gitlab-ce
Commits
d328b416
Commit
d328b416
authored
Mar 17, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tree readme.
parent
6581aea3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
app/models/tree.rb
app/models/tree.rb
+10
-4
No files found.
app/models/tree.rb
View file @
d328b416
class
Tree
include
Gitlab
::
MarkdownHelper
attr_accessor
:entries
attr_accessor
:
repository
,
:sha
,
:path
,
:
entries
def
initialize
(
repository
,
sha
,
path
=
'/'
)
path
=
'/'
if
path
.
blank?
git_repo
=
repository
.
raw_repository
@entries
=
Gitlab
::
Git
::
Tree
.
where
(
git_repo
,
sha
,
path
)
@repository
=
repository
@sha
=
sha
@path
=
path
git_repo
=
@repository
.
raw_repository
@entries
=
Gitlab
::
Git
::
Tree
.
where
(
git_repo
,
@sha
,
@path
)
end
def
readme
return
@readme
if
defined?
(
@readme
)
available_readmes
=
@
blobs
.
select
(
&
:readme?
)
available_readmes
=
blobs
.
select
(
&
:readme?
)
if
available_readmes
.
count
==
0
return
@readme
=
nil
...
...
@@ -26,6 +31,7 @@ class Tree
readme_path
=
path
==
'/'
?
readme_tree
.
name
:
File
.
join
(
path
,
readme_tree
.
name
)
git_repo
=
repository
.
raw_repository
@readme
=
Gitlab
::
Git
::
Blob
.
find
(
git_repo
,
sha
,
readme_path
)
end
...
...
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