diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-27 12:49:59 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-27 12:49:59 +0400 |
commit | e2e11670222cfc5654dbefe05b688ae62add0b9c (patch) | |
tree | 26634ddf28d22bf45c8d76ccacb7526ed2cf05a7 /app | |
parent | 44c55307a0dc1d011cb9deabb2f1d631ebd2cb63 (diff) |
Fix default branch being cached and show old one after change
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/contexts/projects/update_context.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/contexts/projects/update_context.rb b/app/contexts/projects/update_context.rb index 9564dd94688..8a7fcd144f8 100644 --- a/app/contexts/projects/update_context.rb +++ b/app/contexts/projects/update_context.rb @@ -5,12 +5,14 @@ module Projects params[:project].delete(:public) unless can?(current_user, :change_public_mode, project) new_branch = params[:project].delete(:default_branch) - if project.repository.exists? && new_branch != project.repository.root_ref + if project.repository.exists? && new_branch != project.default_branch GitlabShellWorker.perform_async( :update_repository_head, project.path_with_namespace, new_branch ) + + project.reload_default_branch end project.update_attributes(params[:project], as: role) diff --git a/app/models/project.rb b/app/models/project.rb index eab7c14d6c6..2406b3d5dd3 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -26,7 +26,7 @@ class Project < ActiveRecord::Base include Gitlab::ShellAdapter extend Enumerize - + ActsAsTaggableOn.strict_case_match = true attr_accessible :name, :path, :description, :issues_tracker, :label_list, @@ -451,4 +451,9 @@ class Project < ActiveRecord::Base def default_branch @default_branch ||= repository.root_ref if repository.exists? end + + def reload_default_branch + @default_branch = nil + default_branch + end end |