Skip to content

Commit 27f484e

Browse files
committed
Fix wrong updated time when syncing repository
1 parent 8e066c2 commit 27f484e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/repository/branch.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ 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+
if objFmt.Name() != repo.ObjectFormatName {
45+
repo.ObjectFormatName = objFmt.Name() // keep consistent with db
46+
if err = repo_model.UpdateRepositoryColsWithAutoTime(ctx, repo, "object_format_name"); err != nil {
47+
return 0, fmt.Errorf("UpdateRepository: %w", err)
48+
}
4749
}
48-
repo.ObjectFormatName = objFmt.Name() // keep consistent with db
4950

5051
allBranches := container.Set[string]{}
5152
{

0 commit comments

Comments
 (0)