1
1
mirror of https://github.com/go-gitea/gitea synced 2025-10-30 02:48:26 +00:00

Make "update file" API can create a new file when SHA is not set (#35738)

Fix #19008, use GitHub's behavior (empty SHA to create a new file)
This commit is contained in:
wxiaoguang
2025-10-24 12:46:54 +08:00
committed by GitHub
parent 397d666432
commit 9a73a1fb83
5 changed files with 58 additions and 50 deletions

View File

@@ -20,21 +20,19 @@ import (
func getDeleteFileOptions() *api.DeleteFileOptions {
return &api.DeleteFileOptions{
FileOptionsWithSHA: api.FileOptionsWithSHA{
FileOptions: api.FileOptions{
BranchName: "master",
NewBranchName: "master",
Message: "Removing the file new/file.txt",
Author: api.Identity{
Name: "John Doe",
Email: "johndoe@example.com",
},
Committer: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
},
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885",
FileOptions: api.FileOptions{
BranchName: "master",
NewBranchName: "master",
Message: "Removing the file new/file.txt",
Author: api.Identity{
Name: "John Doe",
Email: "johndoe@example.com",
},
Committer: api.Identity{
Name: "Jane Doe",
Email: "janedoe@example.com",
},
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885",
},
}
}