[go: up one dir, main page]

Skip to content

New action to commit changes via commits API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Description

The Commits API provides an endpoint to commit changes (POST /projects/:id/repository/commits).

This works fine. But if you, e.g., change only a small number of lines in a large file, then providing the whole file in the payload is not the best approach as the JSON object to commit the changes gets very big.

A better approach to submit small changes in large files would be to submit only the diff. Using git directly this would be something like this:

# change files locally
...
# create diff
git diff --output=changes.patch

# apply changes on remote side
git apply changes.patch
git commit -a -m "<commit message>"

For the remote part I would prefer a REST Api solution.

Proposal

Add new action patch to POST /projects/:id/repository/commits.

The changes can be specified in standard git diff format using the content attribute of the endpoint.

Possible usecase

Patching files from a CI pipeline with some version-specific code.

Edited by 🤖 GitLab Bot 🤖