summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-07-01 17:46:37 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-07-04 11:03:40 +0100
commitad799589866ee0aa18a66af2fff453daaf8d9457 (patch)
tree9d5368bd1ad52744c489b8029feb206859bcc7f1
parente2e588d2a8f6349208de92a8c0818d5a9178ab19 (diff)
downloadgitlab-ce-ad799589866ee0aa18a66af2fff453daaf8d9457.tar.gz
successfully adds the new version with the updated name on the projects repo
-rw-r--r--app/controllers/concerns/creates_commit.rb3
-rw-r--r--app/controllers/projects/blob_controller.rb6
-rw-r--r--app/services/files/base_service.rb2
3 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb
index dacb5679dd3..84b4a30c6d5 100644
--- a/app/controllers/concerns/creates_commit.rb
+++ b/app/controllers/concerns/creates_commit.rb
@@ -7,7 +7,8 @@ module CreatesCommit
commit_params = @commit_params.merge(
source_project: @project,
source_branch: @ref,
- target_branch: @target_branch
+ target_branch: @target_branch,
+ file_path: @path
)
result = service.new(@tree_edit_project, current_user, commit_params).execute
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 4c42be7d710..e76d5009855 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -44,7 +44,11 @@ class Projects::BlobController < Projects::ApplicationController
"#file-path-#{hexdigest(@path)}"
else
# params[:file_name] stores the new name for the file
- namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, params[:file_name]))
+ unless params[:file_name] == @path
+ @path = params[:file_name]
+ end
+
+ namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @path))
end
create_commit(Files::UpdateService, success_path: after_edit_path,
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb
index 0326a8823e9..cd5b45262ac 100644
--- a/app/services/files/base_service.rb
+++ b/app/services/files/base_service.rb
@@ -15,6 +15,8 @@ module Files
params[:file_content]
end
+ puts @file_path
+
# Validate parameters
validate