Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Ability to create a commit including multiple files #14619

Closed
d-lunyov opened this issue Feb 9, 2021 · 8 comments · Fixed by #24887
Closed

API: Ability to create a commit including multiple files #14619

d-lunyov opened this issue Feb 9, 2021 · 8 comments · Fixed by #24887
Labels
modifies/api This PR adds API routes or modifies them type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@d-lunyov
Copy link

d-lunyov commented Feb 9, 2021

There are three endpoints to make a commit via API: repoUpdateFile, repoCreateFile, repoDeleteFile. But there are no way to make a commit, that contains a multiple changes in multiple files.

@6543
Copy link
Member

6543 commented Feb 9, 2021

What about a endpoint, that apply diff & patch files?

cc @zeripath

@6543 6543 added the modifies/api This PR adds API routes or modifies them label Feb 9, 2021
@zeripath
Copy link
Contributor

zeripath commented Feb 9, 2021

Heheh

Ok I'll simplify and propose the patch endpoint pr. We'll get the rest of stuff sorted later.

@zeripath
Copy link
Contributor

zeripath commented Feb 9, 2021

@d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch?

@d-lunyov
Copy link
Author

@d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch?

@zeripath This is exactly what I do. But I think this is a workaround. In addition, the number of requests to the server increases in proportion to the number of files.

Another git-providers offers:
Github rest api commit steps:

  1. POST a new tree
  2. Create a new commit referred to the new tree SHA
  3. Patch a reference to set a new commit SHA

Gitlab: create a commit with multiple files and actions endpoint

Bitbucket: create new commits in the repository by uploading files

Azure: Push changes to the repository with multiple actions

Bitbucket-server also does not propose a simply-way to create a multiple files to commit, so I'm using a workaround with temporary branch.

@6543 6543 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Feb 10, 2021
@malarinv
Copy link

Is there any progress on this issue? currently I'm blocked by this on a pr I'm working on to enable support for Gitea on https://github.com/fluxcd/go-git-providers . It is used by https://github.com/fluxcd/flux2 to support git resource reconciliation logic.
. see similar api usage from other providers at

@lunny
Copy link
Member

lunny commented Mar 23, 2022

I think we need both patch upload endpoint and multiple files changed endpoint.

@denyskon
Copy link
Member

Are there any updates on that? I created a gitea backend for Static CMS, but without this feature I'm dependent on a hack which fails regularly....

@jimafisk
Copy link

We're trying to implement Gitea as a backend for Plenti too, this unfortunately is a blocker for us. Per @d-lunyov's comment, the way GitLab uses actions works really well for our use-case.

lunny pushed a commit that referenced this issue May 29, 2023
This PR creates an API endpoint for creating/updating/deleting multiple
files in one API call similar to the solution provided by
[GitLab](https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions).

To archive this, the CreateOrUpdateRepoFile and DeleteRepoFIle functions
in files service are unified into one function supporting multiple files
and actions.

Resolves #14619
@lunny lunny added this to the 1.20.0 milestone May 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants