aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-27 09:36:26 +0800
committerGitHub <noreply@github.com>2023-04-26 21:36:26 -0400
commitcf465b472166ccf6d3e001e3043e4bf43e16e6b3 (patch)
tree071db9815eb7ec3e6d5b01c81a03f60dcf84afa9 /services/repository
parentde265f377113766124e9846e120e2864bf01c60c (diff)
downloadgitea-cf465b472166ccf6d3e001e3043e4bf43e16e6b3.tar.gz
gitea-cf465b472166ccf6d3e001e3043e4bf43e16e6b3.zip
Support uploading file to empty repo by API (#24357)
The uploading API already works (the only nit is the the IsEmpty flag is out-of-sync, this PR also fixes it) Close #14633
Diffstat (limited to 'services/repository')
-rw-r--r--services/repository/files/update.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/repository/files/update.go b/services/repository/files/update.go
index 45a4692396..25014f4418 100644
--- a/services/repository/files/update.go
+++ b/services/repository/files/update.go
@@ -458,6 +458,11 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
if err != nil {
return nil, err
}
+
+ if repo.IsEmpty {
+ _ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: repo.ID, IsEmpty: false}, "is_empty")
+ }
+
return file, nil
}