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
Boxiang Sun
gitlab-ce
Commits
aad3b6dd
Commit
aad3b6dd
authored
8 years ago
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
Show 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
...
@@ -55,6 +55,9 @@ class GitPushService < BaseService
end
end
def
update_main_language
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
current_language
=
@project
.
repository
.
main_language
unless
current_language
==
@project
.
main_language
unless
current_language
==
@project
.
main_language
...
...
This diff is collapsed.
Click to expand it.
spec/services/git_push_service_spec.rb
View file @
aad3b6dd
...
@@ -159,19 +159,29 @@ describe GitPushService, services: true do
...
@@ -159,19 +159,29 @@ describe GitPushService, services: true do
end
end
describe
"Updates main language"
do
describe
"Updates main language"
do
context
"before push"
do
context
"before push"
do
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
nil
)
}
end
end
context
"after push"
do
context
"after push"
do
before
do
before
do
@service
=
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@
ref
)
@service
=
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
ref
)
end
end
context
"to master"
do
let
(
:ref
)
{
@ref
}
it
{
expect
(
@service
.
update_main_language
).
to
eq
(
true
)
}
it
{
expect
(
@service
.
update_main_language
).
to
eq
(
true
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
}
it
{
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
}
end
end
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
end
...
...
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