diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-03-14 07:29:49 +0100 |
---|---|---|
committer | jacopo-beschi-intersail <jacopo.beschi@intersail.it> | 2017-03-21 11:51:53 +0100 |
commit | 7b04b63eeb8e3d6730acec3045a54f95968b3dac (patch) | |
tree | ee8214a00a882236d7bb2756553354fc024d9c59 /app | |
parent | 0eff4f14ccae7d979e6fa20f0bb875e4591351e8 (diff) | |
download | gitlab-ce-7b04b63eeb8e3d6730acec3045a54f95968b3dac.tar.gz |
New directory from interface on existing branch
The user can create a new directory on a different branch than the
source branch when the branch already exists.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/application_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/projects/tree_controller.rb | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index e2f81b09adc..f1a93ccb3ad 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -89,4 +89,9 @@ class Projects::ApplicationController < ApplicationController def builds_enabled return render_404 unless @project.feature_available?(:builds, current_user) end + + def update_ref + branch_exists = @repository.find_branch(@target_branch) + @ref = @target_branch if branch_exists + end end diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 52fc67d162c..80a95c6158b 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -89,11 +89,6 @@ class Projects::BlobController < Projects::ApplicationController private - def update_ref - branch_exists = @repository.find_branch(@target_branch) - @ref = @target_branch if branch_exists - end - def blob @blob ||= Blob.decorate(@repository.blob_at(@commit.id, @path)) diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 4f094146348..637b61504d8 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -34,6 +34,7 @@ class Projects::TreeController < Projects::ApplicationController def create_dir return render_404 unless @commit_params.values.all? + update_ref create_commit(Files::CreateDirService, success_notice: "The directory has been successfully created.", success_path: namespace_project_tree_path(@project.namespace, @project, File.join(@target_branch, @dir_name)), failure_path: namespace_project_tree_path(@project.namespace, @project, @ref)) |