0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-20 19:08:29 +02:00

Additionally check if path changed to trigger pure rename operation

This commit is contained in:
bytedream 2025-05-08 23:06:08 +02:00
parent 3348c04cc9
commit 7133834ffe

View File

@ -297,7 +297,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
operation := "update"
if isNewFile {
operation = "create"
} else if !form.Content.Has() {
} else if !form.Content.Has() && ctx.Repo.TreePath != form.TreePath {
// The form content only has data if file is representable as text, is not too large and not in lfs. If it doesn't
// have data, the only possible operation is a rename
operation = "rename"