BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e1bc16cb
Commit
e1bc16cb
authored
Apr 05, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'reorder-language' into 'master'
Update language after doing all other operations See merge request !3533
parents
353365c7
aad3b6dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
git_push_service.rb
app/services/git_push_service.rb
+7
-3
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 @
e1bc16cb
...
...
@@ -43,17 +43,21 @@ class GitPushService < BaseService
@push_commits
=
@project
.
repository
.
commits_between
(
params
[
:oldrev
],
params
[
:newrev
])
process_commit_messages
end
# Checks if the main language has changed in the project and if so
# it updates it accordingly
update_main_language
# Update merge requests that may be affected by this push. A new branch
# could cause the last commit of a merge request to change.
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
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 @
e1bc16cb
...
...
@@ -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