summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorMike Greiling <mgreiling@gitlab.com>2017-08-08 05:54:37 +0000
committerMike Greiling <mgreiling@gitlab.com>2017-08-08 05:54:37 +0000
commit8ec81d9e27a4a6368ab329fca38e04b8f729a44f (patch)
tree4488184f950fb66ae761209952722bb72bf18b72 /lib/api
parent9e7ac48bc11141762816f157247baaf9e61618b3 (diff)
parent0994bbf9dd79413b3c22381bc2d82fcc41aa13bc (diff)
downloadgitlab-ce-8ec81d9e27a4a6368ab329fca38e04b8f729a44f.tar.gz
Merge branch 'ide' into 'master'
Add Multi-File Editor Using Monaco/VSCode Closes #31890 See merge request !12198
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/commits.rb7
-rw-r--r--lib/api/files.rb7
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index bcb842b9211..a1cd8cc0058 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -53,16 +53,19 @@ module API
detail 'This feature was introduced in GitLab 8.13'
end
params do
- requires :branch, type: String, desc: 'The name of branch'
+ requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide `start_branch`.'
requires :commit_message, type: String, desc: 'Commit message'
requires :actions, type: Array[Hash], desc: 'Actions to perform in commit'
+ optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from'
optional :author_email, type: String, desc: 'Author email for commit'
optional :author_name, type: String, desc: 'Author name for commit'
end
post ":id/repository/commits" do
authorize! :push_code, user_project
- attrs = declared_params.merge(start_branch: declared_params[:branch], branch_name: declared_params[:branch])
+ attrs = declared_params
+ attrs[:branch_name] = attrs.delete(:branch)
+ attrs[:start_branch] ||= attrs[:branch_name]
result = ::Files::MultiService.new(user_project, current_user, attrs).execute
diff --git a/lib/api/files.rb b/lib/api/files.rb
index 521287ee2b4..450334fee84 100644
--- a/lib/api/files.rb
+++ b/lib/api/files.rb
@@ -4,7 +4,7 @@ module API
def commit_params(attrs)
{
file_path: attrs[:file_path],
- start_branch: attrs[:branch],
+ start_branch: attrs[:start_branch] || attrs[:branch],
branch_name: attrs[:branch],
commit_message: attrs[:commit_message],
file_content: attrs[:content],
@@ -37,8 +37,9 @@ module API
params :simple_file_params do
requires :file_path, type: String, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb'
- requires :branch, type: String, desc: 'The name of branch'
- requires :commit_message, type: String, desc: 'Commit Message'
+ requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide `start_branch`.'
+ requires :commit_message, type: String, desc: 'Commit message'
+ optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from'
optional :author_email, type: String, desc: 'The email of the author'
optional :author_name, type: String, desc: 'The name of the author'
end