diff options
author | Nick Thomas <nick@gitlab.com> | 2019-07-18 10:47:35 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-18 10:47:35 +0000 |
commit | 3069cb25451cf9aad4840551b7286fee1c5aebc8 (patch) | |
tree | 3f7daffc2fd7adfbebe14a625293e2f005785140 /lib/api/commits.rb | |
parent | 69c113fc8cff7c7646bf252d32b1956b255eaf37 (diff) | |
parent | d4cc92db09a0c765556882943b7508075a0ab0e2 (diff) | |
download | gitlab-ce-3069cb25451cf9aad4840551b7286fee1c5aebc8.tar.gz |
Merge branch 'webide-commit-use-correct-parent' into 'master'
Use correct parent when committing in WebIDE
See merge request gitlab-org/gitlab-ce!29598
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r-- | lib/api/commits.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index fe910d46f6c..e4f4e79cd46 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -76,7 +76,7 @@ module API detail 'This feature was introduced in GitLab 8.13' end params do - requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide `start_branch`.', allow_blank: false + requires :branch, type: String, desc: 'Name of the branch to commit into. To create a new branch, also provide either `start_branch` or `start_sha`, and optionally `start_project`.', allow_blank: false requires :commit_message, type: String, desc: 'Commit message' requires :actions, type: Array, desc: 'Actions to perform in commit' do requires :action, type: String, desc: 'The action to perform, `create`, `delete`, `move`, `update`, `chmod`', values: %w[create update move delete chmod].freeze @@ -98,12 +98,16 @@ module API requires :execute_filemode, type: Boolean, desc: 'When `true/false` enables/disables the execute flag on the file.' end end - optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from' - optional :start_project, types: [Integer, String], desc: 'The ID or path of the project to start the commit from' + + optional :start_branch, type: String, desc: 'Name of the branch to start the new branch from' + optional :start_sha, type: String, desc: 'SHA of the commit to start the new branch from' + mutually_exclusive :start_branch, :start_sha + + optional :start_project, types: [Integer, String], desc: 'The ID or path of the project to start the new branch from' optional :author_email, type: String, desc: 'Author email for commit' optional :author_name, type: String, desc: 'Author name for commit' optional :stats, type: Boolean, default: true, desc: 'Include commit stats' - optional :force, type: Boolean, default: false, desc: 'When `true` overwrites the target branch with a new commit based on the `start_branch`' + optional :force, type: Boolean, default: false, desc: 'When `true` overwrites the target branch with a new commit based on the `start_branch` or `start_sha`' end post ':id/repository/commits' do if params[:start_project] @@ -118,7 +122,7 @@ module API attrs = declared_params attrs[:branch_name] = attrs.delete(:branch) - attrs[:start_branch] ||= attrs[:branch_name] + attrs[:start_branch] ||= attrs[:branch_name] unless attrs[:start_sha] attrs[:start_project] = start_project if start_project result = ::Files::MultiService.new(user_project, current_user, attrs).execute |