diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-27 09:36:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 21:36:26 -0400 |
commit | cf465b472166ccf6d3e001e3043e4bf43e16e6b3 (patch) | |
tree | 071db9815eb7ec3e6d5b01c81a03f60dcf84afa9 /services/repository | |
parent | de265f377113766124e9846e120e2864bf01c60c (diff) | |
download | gitea-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.go | 5 |
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 } |