Querying the Commit Difference Information of a Repository
Description
This API is used to query commit difference information by commit ID.
URI
GET /v2/projects/{repo_id}/repository/commits/{sha}/diff
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repo_id |
Yes |
Integer |
Repository short ID |
|
sha |
Yes |
String |
Commit ID, which is the branch or tag name of the repository. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Response error |
|
result |
Array of DiffCommitInfo objects |
Difference list |
|
status |
String |
Response status |
|
Parameter |
Type |
Description |
|---|---|---|
|
old_path |
String |
Old file path |
|
new_path |
String |
New file path |
|
a_mode |
String |
Old file mode |
|
b_mode |
String |
New file mode |
|
new_file |
Boolean |
Whether to add files during the modification |
|
renamed_file |
Boolean |
Whether to rename a file during the modification |
|
deleted_file |
Boolean |
Whether to delete files during the modification |
|
diff |
Boolean |
Difference information |
Request Examples
GET https://{endpoint}/v2/projects/859341/repository/commits/master/diff
Response Examples
Status code: 200
Request succeeded
{
"result" : [ {
"diff" : "@@ -1,4 +1,7 @@\n y_mr_0721\n+\n+\n+\n edwwd\n # css \n **hhrh**",
"old_path" : "README.md",
"new_path" : "README.md",
"a_mode" : "100644",
"b_mode" : "100644",
"new_file" : false,
"renamed_file" : false,
"deleted_file" : false
} ],
"status" : "success"
}
Status Codes
|
Status Codes |
Description |
|---|---|
|
200 |
Request succeeded |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot