Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d4147926
Commit
d4147926
authored
Aug 04, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add start_branch to files and commits APIs
parent
c41f64d7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
doc/api/commits.md
doc/api/commits.md
+2
-1
doc/api/repository_files.md
doc/api/repository_files.md
+6
-3
lib/api/commits.rb
lib/api/commits.rb
+4
-2
lib/api/files.rb
lib/api/files.rb
+4
-3
No files found.
doc/api/commits.md
View file @
d4147926
...
...
@@ -69,8 +69,9 @@ POST /projects/:id/repository/commits
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
|
|
`branch`
| string | yes |
The name of a branch
|
|
`branch`
| string | yes |
Name of the branch to commit into. To create a new branch, also provide
`start_branch`
.
|
|
`commit_message`
| string | yes | Commit message |
|
`start_branch`
| string | no | Name of the branch to start the new commit from |
|
`actions[]`
| array | yes | An array of action hashes to commit as a batch. See the next table for what attributes it can take. |
|
`author_email`
| string | no | Specify the commit author's email address |
|
`author_name`
| string | no | Specify the commit author's name |
...
...
doc/api/repository_files.md
View file @
d4147926
...
...
@@ -76,7 +76,8 @@ Example response:
Parameters:
-
`file_path`
(required) - Url encoded full path to new file. Ex. lib%2Fclass%2Erb
-
`branch`
(required) - The name of branch
-
`branch`
(required) - Name of the branch
-
`start_branch`
(optional) - Name of the branch to start the new commit from
-
`encoding`
(optional) - Change encoding to 'base64'. Default is text.
-
`author_email`
(optional) - Specify the commit author's email address
-
`author_name`
(optional) - Specify the commit author's name
...
...
@@ -105,7 +106,8 @@ Example response:
Parameters:
-
`file_path`
(required) - Url encoded full path to new file. Ex. lib%2Fclass%2Erb
-
`branch`
(required) - The name of branch
-
`branch`
(required) - Name of the branch
-
`start_branch`
(optional) - Name of the branch to start the new commit from
-
`encoding`
(optional) - Change encoding to 'base64'. Default is text.
-
`author_email`
(optional) - Specify the commit author's email address
-
`author_name`
(optional) - Specify the commit author's name
...
...
@@ -144,7 +146,8 @@ Example response:
Parameters:
-
`file_path`
(required) - Url encoded full path to new file. Ex. lib%2Fclass%2Erb
-
`branch`
(required) - The name of branch
-
`branch`
(required) - Name of the branch
-
`start_branch`
(optional) - Name of the branch to start the new commit from
-
`author_email`
(optional) - Specify the commit author's email address
-
`author_name`
(optional) - Specify the commit author's name
-
`commit_message`
(required) - Commit message
lib/api/commits.rb
View file @
d4147926
...
...
@@ -53,16 +53,18 @@ 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
[
:branch_name
]
=
declared_params
.
delete
(
:branch
)
attrs
[
:start_branch
]
||=
attrs
[
:branch_name
]
result
=
::
Files
::
MultiService
.
new
(
user_project
,
current_user
,
attrs
).
execute
...
...
lib/api/files.rb
View file @
d4147926
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment