summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-27 15:22:48 +0100
committerDouwe Maan <douwe@gitlab.com>2015-10-27 15:22:48 +0100
commit2bbdeb91ca6b2c1e4fa10dbed34f9fff39e790f4 (patch)
tree68cd0160edb41d222ad68d60ab98c56e386ba1e5
parent740feeec772565b0734cae816b31dcb47e5f4492 (diff)
downloadgitlab-ce-2bbdeb91ca6b2c1e4fa10dbed34f9fff39e790f4.tar.gz
Reset memoized project repository when path changes
-rw-r--r--app/models/project.rb1
-rw-r--r--app/views/projects/edit.html.haml4
2 files changed, 3 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 74b89aad499..e0b44ee9bea 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -647,6 +647,7 @@ class Project < ActiveRecord::Base
gitlab_shell.mv_repository("#{old_path_with_namespace}.wiki", "#{new_path_with_namespace}.wiki")
send_move_instructions(old_path_with_namespace)
reset_events_cache
+ @repository = nil
rescue
# Returning false does not rollback after_* transaction but gives
# us information about failing some of tasks
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index afbf88b5507..f5bb00b0612 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -24,10 +24,10 @@
.col-sm-10
= f.text_area :description, placeholder: "Awesome project", class: "form-control", rows: 3, maxlength: 250
- - if @project.repository.exists? && @project.repository.branch_names.any?
+ - unless @project.empty_repo?
.form-group
= f.label :default_branch, "Default Branch", class: 'control-label'
- .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'})
+ .col-sm-10= f.select(:default_branch, @project.repository.branch_names, {}, {class: 'select2 select-wide'})
= render 'shared/visibility_level', f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can_change_visibility_level?(@project, current_user), form_model: @project