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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
aad3b6dd
Commit
aad3b6dd
authored
Apr 05, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update language only on HEAD of the repository
parent
b8d1545b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-0
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+14
-4
No files found.
app/services/git_push_service.rb
View file @
aad3b6dd
...
...
@@ -55,6 +55,9 @@ class GitPushService < BaseService
end
def
update_main_language
return
unless
is_default_branch?
return
unless
push_to_new_branch?
||
push_to_existing_branch?
current_language
=
@project
.
repository
.
main_language
unless
current_language
==
@project
.
main_language
...
...
spec/services/git_push_service_spec.rb
View file @
aad3b6dd
...
...
@@ -159,18 +159,28 @@ describe GitPushService, services: true do
end
describe
"Updates main language"
do
context
"before push"
do
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
end
context
"after push"
do
before
do
@service
=
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
@service
=
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
ref
)
end
context
"to master"
do
let
(
:ref
)
{
@ref
}
it
{
expect
(
@service
.
update_main_language
).
to
eq
(
true
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
}
end
it
{
expect
(
@service
.
update_main_language
).
to
eq
(
true
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
}
context
"to other branch"
do
let
(
:ref
)
{
'refs/heads/feature/branch'
}
it
{
expect
(
@service
.
update_main_language
).
to
eq
(
nil
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
end
end
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