Skip to main content
POST
/
api
/
repos
/
{repo_name}
/
diff-commit
Create Commit from Diff
curl --request POST \
  --url https://api.{cluster}.code.storage/api/repos/{repo_name}/diff-commit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/x-ndjson' \
  --data '
"{\"metadata\":{\"target_branch\":\"main\",\"expected_head_sha\":\"d34db33fd34db33fd34db33fd34db33fd34db33f\",\"commit_message\":\"Apply generated patch\",\"author\":{\"name\":\"Diff Bot\",\"email\":\"diff@example.com\"}}}\n{\"diff_chunk\":{\"data\":\"ZGlmZiAtLWdpdCBhL1JFQURNRS5tZCBiL1JFQURNRS5tZAo=\",\"eof\":false}}\n{\"diff_chunk\":{\"data\":\"QEAgLTEsMSArMSwyIEBACi1IZWxsbworSGVsbG8gV29ybGQK\",\"eof\":true}}\n"
'
{
  "commit": {
    "blob_count": 1,
    "commit_sha": "<string>",
    "pack_bytes": 1,
    "target_branch": "<string>",
    "tree_sha": "<string>"
  },
  "result": {
    "branch": "<string>",
    "new_sha": "<string>",
    "old_sha": "<string>",
    "status": "<string>",
    "success": true,
    "message": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://code.storage/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

repo_name
string
required

Repository name. Names that contain / or any other character that is not safe in a URL path segment must be URL encoded so the value occupies a single path segment. For example pierre/example is sent as pierre%2Fexample. Plain names such as example can be sent as-is. The server URL-decodes the value before resolving the repository.

Body

application/x-ndjson

Send newline-delimited JSON where the first line is a metadata object and each following line is a diff_chunk. The combined diff must be compatible with git apply --cached --binary.

NDJSON stream. The first line must be metadata; subsequent lines must be diff_chunk payloads. Decoded diff chunks are limited to 4 MiB each.

Response

Commit created from the supplied diff.

Result of applying an NDJSON commit pack, including the resulting commit and branch update.

commit
object
required

Commit object information generated by the storage service.

result
object
required

Final branch update outcome.