diff options
author | Denys Konovalov <privat@denyskon.de> | 2023-05-29 11:41:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 17:41:35 +0800 |
commit | 275d4b7e3f4595206e5c4b1657d4f6d6969d9ce2 (patch) | |
tree | 4283f97bce56c7783e6c77c380cbe4ce06277720 /tests/integration/pull_merge_test.go | |
parent | 245f2c08db34e535576633748fc143bb09097ca8 (diff) | |
download | gitea-275d4b7e3f4595206e5c4b1657d4f6d6969d9ce2.tar.gz gitea-275d4b7e3f4595206e5c4b1657d4f6d6969d9ce2.zip |
API endpoint for changing/creating/deleting multiple files (#24887)
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
Diffstat (limited to 'tests/integration/pull_merge_test.go')
-rw-r--r-- | tests/integration/pull_merge_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/integration/pull_merge_test.go b/tests/integration/pull_merge_test.go index 9271f25e5f..f6a36f60af 100644 --- a/tests/integration/pull_merge_test.go +++ b/tests/integration/pull_merge_test.go @@ -367,22 +367,30 @@ func TestConflictChecking(t *testing.T) { assert.NotEmpty(t, baseRepo) // create a commit on new branch. - _, err = files_service.CreateOrUpdateRepoFile(git.DefaultContext, baseRepo, user, &files_service.UpdateRepoFileOptions{ - TreePath: "important_file", + _, err = files_service.ChangeRepoFiles(git.DefaultContext, baseRepo, user, &files_service.ChangeRepoFilesOptions{ + Files: []*files_service.ChangeRepoFile{ + { + Operation: "create", + TreePath: "important_file", + Content: "Just a non-important file", + }, + }, Message: "Add a important file", - Content: "Just a non-important file", - IsNewFile: true, OldBranch: "main", NewBranch: "important-secrets", }) assert.NoError(t, err) // create a commit on main branch. - _, err = files_service.CreateOrUpdateRepoFile(git.DefaultContext, baseRepo, user, &files_service.UpdateRepoFileOptions{ - TreePath: "important_file", + _, err = files_service.ChangeRepoFiles(git.DefaultContext, baseRepo, user, &files_service.ChangeRepoFilesOptions{ + Files: []*files_service.ChangeRepoFile{ + { + Operation: "create", + TreePath: "important_file", + Content: "Not the same content :P", + }, + }, Message: "Add a important file", - Content: "Not the same content :P", - IsNewFile: true, OldBranch: "main", NewBranch: "main", }) |