Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-03-03 13:51:48 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-07 23:59:39 +0300
commit96c02551070a5f2d90beea7068fc6fddbf1498e8 (patch)
tree1b2635f9add269a5675f612573e64f3e1eee262b /app/services/git_push_service.rb
parent8039bbf7f8e686bdf1e8c00c44faa8a97a6c6fdb (diff)
moves the main_language update logic to git push service
Diffstat (limited to 'app/services/git_push_service.rb')
-rw-r--r--app/services/git_push_service.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 9ba200f7bde..ab883b6ef2c 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -14,6 +14,7 @@ class GitPushService < BaseService
# 3. Recognizes cross-references from commit messages
# 4. Executes the project's web hooks
# 5. Executes the project's services
+ # 6. Checks if the project's main language has changed
#
def execute
@project.repository.after_push_commit(branch_name)
@@ -42,6 +43,9 @@ 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
@@ -49,6 +53,14 @@ class GitPushService < BaseService
protected
+ def update_main_language
+ current_language = @project.repository.main_language
+
+ unless current_language == @project.main_language
+ @project.update_attributes(main_language: current_language)
+ end
+ end
+
def update_merge_requests
@project.update_merge_requests(params[:oldrev], params[:newrev], params[:ref], current_user)