diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-13 16:56:33 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-13 16:56:33 +0000 |
commit | 1585608bdcf932b58d301a7943c01ea824ea524e (patch) | |
tree | 86dc4290cf711aa6f19ab7dc64d432c849cd004b /app/controllers/projects/blob_controller.rb | |
parent | 1d4b11f3388ddd7cf0076f95ac26196f6949dc0b (diff) | |
parent | e0fe2834ebe6d9678444c8a10b79ca093f944232 (diff) | |
download | gitlab-ce-1585608bdcf932b58d301a7943c01ea824ea524e.tar.gz |
Merge branch '24501-new-file-existing-branch' into 'master'
New file from interface on existing branch
Closes #24501
See merge request !8427
Diffstat (limited to 'app/controllers/projects/blob_controller.rb')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 21ed0660762..52fc67d162c 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -23,6 +23,8 @@ class Projects::BlobController < Projects::ApplicationController end def create + update_ref + create_commit(Files::CreateService, success_notice: "The file has been successfully created.", success_path: -> { namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) }, failure_view: :new, @@ -87,6 +89,11 @@ 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)) |