From fb3e80106d2551a628573cd2fb91cfc61a5ab8a5 Mon Sep 17 00:00:00 2001 From: bytedream Date: Thu, 8 May 2025 12:35:52 +0200 Subject: [PATCH] Update comments and names --- services/repository/files/update.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/services/repository/files/update.go b/services/repository/files/update.go index 4bee1dc5e4..661b9bb09d 100644 --- a/services/repository/files/update.go +++ b/services/repository/files/update.go @@ -490,13 +490,14 @@ func CreateOrUpdateFile(ctx context.Context, t *TemporaryUploadRepository, file var treeObjectContentReader io.Reader = file.ContentReader var oldEntry *git.TreeEntry - // If no new content is committed, use the file from the last commit as content + // If no new content is committed, which is only the case if file is renamed, use the old file from the last commit as + // content if file.ContentReader == nil { - lastCommit, err := t.GetLastCommit(ctx) + lastCommitID, err := t.GetLastCommit(ctx) if err != nil { return err } - commit, err := t.GetCommit(lastCommit) + commit, err := t.GetCommit(lastCommitID) if err != nil { return err }