Commit e2e11670222cfc5654dbefe05b688ae62add0b9c
1 parent
44c55307
Exists in
master
and in
4 other branches
Fix default branch being cached and show old one after change
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
9 additions
and
2 deletions
Show diff stats
app/contexts/projects/update_context.rb
... | ... | @@ -5,12 +5,14 @@ module Projects |
5 | 5 | params[:project].delete(:public) unless can?(current_user, :change_public_mode, project) |
6 | 6 | new_branch = params[:project].delete(:default_branch) |
7 | 7 | |
8 | - if project.repository.exists? && new_branch != project.repository.root_ref | |
8 | + if project.repository.exists? && new_branch != project.default_branch | |
9 | 9 | GitlabShellWorker.perform_async( |
10 | 10 | :update_repository_head, |
11 | 11 | project.path_with_namespace, |
12 | 12 | new_branch |
13 | 13 | ) |
14 | + | |
15 | + project.reload_default_branch | |
14 | 16 | end |
15 | 17 | |
16 | 18 | project.update_attributes(params[:project], as: role) | ... | ... |
app/models/project.rb
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | class Project < ActiveRecord::Base |
27 | 27 | include Gitlab::ShellAdapter |
28 | 28 | extend Enumerize |
29 | - | |
29 | + | |
30 | 30 | ActsAsTaggableOn.strict_case_match = true |
31 | 31 | |
32 | 32 | attr_accessible :name, :path, :description, :issues_tracker, :label_list, |
... | ... | @@ -451,4 +451,9 @@ class Project < ActiveRecord::Base |
451 | 451 | def default_branch |
452 | 452 | @default_branch ||= repository.root_ref if repository.exists? |
453 | 453 | end |
454 | + | |
455 | + def reload_default_branch | |
456 | + @default_branch = nil | |
457 | + default_branch | |
458 | + end | |
454 | 459 | end | ... | ... |