aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo/update.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo/update.go')
-rw-r--r--models/repo/update.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/repo/update.go b/models/repo/update.go
index 8a15477a80..f82ff7c76c 100644
--- a/models/repo/update.go
+++ b/models/repo/update.go
@@ -42,12 +42,18 @@ func UpdateRepositoryUpdatedTime(ctx context.Context, repoID int64, updateTime t
// UpdateRepositoryColsWithAutoTime updates repository's columns
func UpdateRepositoryColsWithAutoTime(ctx context.Context, repo *Repository, cols ...string) error {
+ if len(cols) == 0 {
+ return nil
+ }
_, err := db.GetEngine(ctx).ID(repo.ID).Cols(cols...).Update(repo)
return err
}
// UpdateRepositoryColsNoAutoTime updates repository's columns and but applies time change automatically
func UpdateRepositoryColsNoAutoTime(ctx context.Context, repo *Repository, cols ...string) error {
+ if len(cols) == 0 {
+ return nil
+ }
_, err := db.GetEngine(ctx).ID(repo.ID).Cols(cols...).NoAutoTime().Update(repo)
return err
}