Refactor "change file" API (#34855)

Follow up the "editor" refactor, use the same approach to simplify code,
and fix some docs & comments

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
wxiaoguang
2025-06-26 02:25:20 +08:00
committed by GitHub
parent 1839110ea6
commit 75aa23a665
10 changed files with 199 additions and 357 deletions

View File

@@ -44,7 +44,6 @@ type ApplyDiffPatchOptions struct {
NewBranch string
Message string
Content string
SHA string
Author *IdentityOptions
Committer *IdentityOptions
Dates *CommitDateOptions

View File

@@ -113,7 +113,7 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
return nil, err
}
// If no branch name is set, assume default branch
// If no branch name is set, assume the default branch
if opts.OldBranch == "" {
opts.OldBranch = repo.DefaultBranch
}