diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-17 12:43:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 04:43:39 +0000 |
commit | c6b92c84fe5e4b1fad1711611d8a0d453fd7e311 (patch) | |
tree | 4114daa0285e49bf8d6ac51a416c0ec1942b0f43 /services | |
parent | 16aee56e6a6a23d71465c703df796e6e8a274aad (diff) | |
download | gitea-c6b92c84fe5e4b1fad1711611d8a0d453fd7e311.tar.gz gitea-c6b92c84fe5e4b1fad1711611d8a0d453fd7e311.zip |
Sync repo's IsEmpty status correctly (#26517)
Close #26509
Diffstat (limited to 'services')
-rw-r--r-- | services/repository/files/update.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/repository/files/update.go b/services/repository/files/update.go index cd7713341d..f01092d360 100644 --- a/services/repository/files/update.go +++ b/services/repository/files/update.go @@ -263,7 +263,9 @@ func ChangeRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use } if repo.IsEmpty { - _ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: repo.ID, IsEmpty: false, DefaultBranch: opts.NewBranch}, "is_empty", "default_branch") + if isEmpty, err := gitRepo.IsEmpty(); err == nil && !isEmpty { + _ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: repo.ID, IsEmpty: false, DefaultBranch: opts.NewBranch}, "is_empty", "default_branch") + } } return filesResponse, nil |