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
6d2a0a6b
Commit
6d2a0a6b
authored
May 25, 2016
by
Josh Frye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove main_language and tests
parent
49343f9a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
84 deletions
+23
-84
app/models/repository.rb
app/models/repository.rb
+0
-6
app/services/git_push_service.rb
app/services/git_push_service.rb
+0
-17
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+0
-3
db/migrate/20160525205328_remove_main_language_from_projects.rb
...rate/20160525205328_remove_main_language_from_projects.rb
+21
-0
db/schema.rb
db/schema.rb
+1
-2
spec/features/issues/filter_issues_spec.rb
spec/features/issues/filter_issues_spec.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+0
-12
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+0
-43
No files found.
app/models/repository.rb
View file @
6d2a0a6b
...
@@ -972,12 +972,6 @@ class Repository
...
@@ -972,12 +972,6 @@ class Repository
end
end
end
end
def
main_language
return
unless
head_exists?
Linguist
::
Repository
.
new
(
rugged
,
rugged
.
head
.
target_id
).
language
end
def
avatar
def
avatar
return
nil
unless
exists?
return
nil
unless
exists?
...
...
app/services/git_push_service.rb
View file @
6d2a0a6b
...
@@ -53,10 +53,6 @@ class GitPushService < BaseService
...
@@ -53,10 +53,6 @@ class GitPushService < BaseService
# could cause the last commit of a merge request to change.
# could cause the last commit of a merge request to change.
update_merge_requests
update_merge_requests
# Checks if the main language has changed in the project and if so
# it updates it accordingly
update_main_language
perform_housekeeping
perform_housekeeping
end
end
...
@@ -64,19 +60,6 @@ class GitPushService < BaseService
...
@@ -64,19 +60,6 @@ class GitPushService < BaseService
@project
.
repository
.
copy_gitattributes
(
params
[
:ref
])
@project
.
repository
.
copy_gitattributes
(
params
[
:ref
])
end
end
def
update_main_language
# Performance can be bad so for now only check main_language once
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/14937
return
if
@project
.
main_language
.
present?
return
unless
is_default_branch?
return
unless
push_to_new_branch?
||
push_to_existing_branch?
current_language
=
@project
.
repository
.
main_language
@project
.
update_attributes
(
main_language:
current_language
)
true
end
protected
protected
def
update_merge_requests
def
update_merge_requests
...
...
app/views/shared/projects/_project.html.haml
View file @
6d2a0a6b
...
@@ -12,9 +12,6 @@
...
@@ -12,9 +12,6 @@
%li
.project-row
{
class:
css_class
}
%li
.project-row
{
class:
css_class
}
=
cache
(
cache_key
)
do
=
cache
(
cache_key
)
do
.controls
.controls
-
if
project
.
main_language
%span
=
project
.
main_language
-
if
project
.
commit
.
try
(
:status
)
-
if
project
.
commit
.
try
(
:status
)
%span
%span
=
render_commit_status
(
project
.
commit
)
=
render_commit_status
(
project
.
commit
)
...
...
db/migrate/20160525205328_remove_main_language_from_projects.rb
0 → 100644
View file @
6d2a0a6b
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
RemoveMainLanguageFromProjects
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def
change
remove_column
:projects
,
:main_language
end
end
db/schema.rb
View file @
6d2a0a6b
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201605
16174813
)
do
ActiveRecord
::
Schema
.
define
(
version:
201605
25205328
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -760,7 +760,6 @@ ActiveRecord::Schema.define(version: 20160516174813) do
...
@@ -760,7 +760,6 @@ ActiveRecord::Schema.define(version: 20160516174813) do
t
.
integer
"build_timeout"
,
default:
3600
,
null:
false
t
.
integer
"build_timeout"
,
default:
3600
,
null:
false
t
.
boolean
"pending_delete"
,
default:
false
t
.
boolean
"pending_delete"
,
default:
false
t
.
boolean
"public_builds"
,
default:
true
,
null:
false
t
.
boolean
"public_builds"
,
default:
true
,
null:
false
t
.
string
"main_language"
t
.
integer
"pushes_since_gc"
,
default:
0
t
.
integer
"pushes_since_gc"
,
default:
0
t
.
boolean
"last_repository_check_failed"
t
.
boolean
"last_repository_check_failed"
t
.
datetime
"last_repository_check_at"
t
.
datetime
"last_repository_check_at"
...
...
spec/features/issues/filter_issues_spec.rb
View file @
6d2a0a6b
...
@@ -186,7 +186,7 @@ describe 'Filter issues', feature: true do
...
@@ -186,7 +186,7 @@ describe 'Filter issues', feature: true do
fill_in
'issue_search'
,
with:
'testing'
fill_in
'issue_search'
,
with:
'testing'
page
.
within
'.issues-list'
do
page
.
within
'.issues-list'
do
expect
(
page
).
to_not
have_selector
(
'.issue'
)
expect
(
page
).
not_to
have_selector
(
'.issue'
)
end
end
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
6d2a0a6b
...
@@ -829,18 +829,6 @@ describe Repository, models: true do
...
@@ -829,18 +829,6 @@ describe Repository, models: true do
end
end
end
end
describe
"#main_language"
do
it
'shows the main language of the project'
do
expect
(
repository
.
main_language
).
to
eq
(
"Ruby"
)
end
it
'returns nil when the repository is empty'
do
allow
(
repository
).
to
receive
(
:empty?
).
and_return
(
true
)
expect
(
repository
.
main_language
).
to
be_nil
end
end
describe
'#before_remove_tag'
do
describe
'#before_remove_tag'
do
it
'flushes the tag cache'
do
it
'flushes the tag cache'
do
expect
(
repository
).
to
receive
(
:expire_tag_count_cache
)
expect
(
repository
).
to
receive
(
:expire_tag_count_cache
)
...
...
spec/services/git_push_service_spec.rb
View file @
6d2a0a6b
...
@@ -158,49 +158,6 @@ describe GitPushService, services: true do
...
@@ -158,49 +158,6 @@ describe GitPushService, services: true do
end
end
end
end
describe
"Updates main language"
do
context
"before push"
do
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
end
context
"after push"
do
def
execute
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
ref
)
end
context
"to master"
do
let
(
:ref
)
{
@ref
}
context
'when main_language is nil'
do
it
'obtains the language from the repository'
do
expect
(
project
.
repository
).
to
receive
(
:main_language
)
execute
end
it
'sets the project main language'
do
execute
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
end
end
context
'when main_language is already set'
do
it
'does not check the repository'
do
execute
# do an initial run to simulate lang being preset
expect
(
project
.
repository
).
not_to
receive
(
:main_language
)
execute
end
end
end
context
"to other branch"
do
let
(
:ref
)
{
'refs/heads/feature/branch'
}
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
end
end
end
describe
"Updates git attributes"
do
describe
"Updates git attributes"
do
context
"for default branch"
do
context
"for default branch"
do
it
"calls the copy attributes method for the first push to the default branch"
do
it
"calls the copy attributes method for the first push to the default branch"
do
...
...
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