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
d9e646a7
Commit
d9e646a7
authored
Feb 29, 2016
by
tiagonbotelho
Committed by
Yorick Peterse
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moves method to repository model
parent
85de3f69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
app/models/project.rb
app/models/project.rb
+1
-7
app/models/repository.rb
app/models/repository.rb
+12
-0
No files found.
app/models/project.rb
View file @
d9e646a7
...
...
@@ -947,12 +947,6 @@ class Project < ActiveRecord::Base
end
def
main_language
unless
empty_repo?
Rails
.
cache
.
fetch
([
self
,
"language"
])
do
Linguist
::
Repository
.
new
(
@repository
.
rugged
,
@repository
.
rugged
.
head
.
target_id
).
language
end
end
@main_language
=
repository
.
main_language
end
end
app/models/repository.rb
View file @
d9e646a7
...
...
@@ -812,6 +812,18 @@ class Repository
raw_repository
.
ls_files
(
actual_ref
)
end
def
main_language
return
@main_language
unless
@main_language
.
nil?
unless
empty?
@main_language
=
cache
.
fetch
(
:main_language
)
do
Linguist
::
Repository
.
new
(
rugged
,
rugged
.
head
.
target_id
).
language
end
end
end
private
def
cache
...
...
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