Skip to content

Commit 5d5b695

Browse files
authored
Skip updating timestamp when sync branch (go-gitea#34875)
1 parent 0af7a7b commit 5d5b695

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/repository/branch.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ func SyncRepoBranchesWithRepo(ctx context.Context, repo *repo_model.Repository,
4141
if err != nil {
4242
return 0, fmt.Errorf("GetObjectFormat: %w", err)
4343
}
44-
_, err = db.GetEngine(ctx).ID(repo.ID).Update(&repo_model.Repository{ObjectFormatName: objFmt.Name()})
45-
if err != nil {
46-
return 0, fmt.Errorf("UpdateRepository: %w", err)
44+
45+
if repo.ObjectFormatName != objFmt.Name() {
46+
repo.ObjectFormatName = objFmt.Name()
47+
_, err = db.GetEngine(ctx).ID(repo.ID).NoAutoTime().Update(&repo_model.Repository{ObjectFormatName: objFmt.Name()})
48+
if err != nil {
49+
return 0, fmt.Errorf("UpdateRepository: %w", err)
50+
}
4751
}
48-
repo.ObjectFormatName = objFmt.Name() // keep consistent with db
4952

5053
allBranches := container.Set[string]{}
5154
{

0 commit comments

Comments
 (0)