summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Read <eread@gitlab.com>2019-04-01 02:45:24 +0000
committerEvan Read <eread@gitlab.com>2019-04-01 02:45:24 +0000
commite08c693babaf1a774061ce2bd185946f4717e8ec (patch)
tree5e66871ae66db3446d24daf3e54124f6e354574c
parentcc0a3b8c9218e2aa23afdce7e69344a07d686df9 (diff)
parenta7795730b163ed5daf0e0f31debbf6d73e4e3fa0 (diff)
downloadgitlab-ce-e08c693babaf1a774061ce2bd185946f4717e8ec.tar.gz
Merge branch 'patch-48' into 'master'
Update to the commits.md, more details about how to use the --form method for creating a commit See merge request gitlab-org/gitlab-ce!26329
-rw-r--r--doc/api/commits.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/api/commits.md b/doc/api/commits.md
index 7a044ce881a..c8c282a71d9 100644
--- a/doc/api/commits.md
+++ b/doc/api/commits.md
@@ -155,6 +155,32 @@ Example response:
}
```
+GitLab supports [form encoding](../README.md#encoding-api-parameters-of-array-and-hash-types). The following is an example using Commit API with form encoding:
+
+```bash
+curl --request POST \
+ --form "branch=master" \
+ --form "commit_message=some commit message" \
+ --form "start_branch=master" \
+ --form "actions[][action]=create" \
+ --form "actions[][file_path]=foo/bar" \
+ --form "actions[][content]=</path/to/local.file" \
+ --form "actions[][action]=delete" \
+ --form "actions[][file_path]=foo/bar2" \
+ --form "actions[][action]=move" \
+ --form "actions[][file_path]=foo/bar3" \
+ --form "actions[][previous_path]=foo/bar4" \
+ --form "actions[][content]=</path/to/local1.file" \
+ --form "actions[][action]=update" \
+ --form "actions[][file_path]=foo/bar5" \
+ --form "actions[][content]=</path/to/local2.file" \
+ --form "actions[][action]=chmod" \
+ --form "actions[][file_path]=foo/bar5" \
+ --form "actions[][execute_filemode]=true" \
+ --header "PRIVATE-TOKEN: <your_access_token>" \
+ "https://gitlab.example.com/api/v4/projects/1/repository/commits"
+```
+
## Get a single commit
Get a specific commit identified by the commit hash or name of a branch or tag.