-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Move repository model into models/repo #17933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
708860a
to
4e5658d
Compare
It would be better to keep model related prefix for functions in root For example, And Otherwise, LGTM |
I changed most of them but kept |
418fee0
to
7ac88ae
Compare
Codecov Report
@@ Coverage Diff @@
## main #17933 +/- ##
==========================================
+ Coverage 45.34% 45.37% +0.03%
==========================================
Files 815 817 +2
Lines 90768 90806 +38
==========================================
+ Hits 41157 41206 +49
+ Misses 43045 43036 -9
+ Partials 6566 6564 -2
Continue to review full report at Codecov.
|
@@ -361,21 +364,24 @@ func repoAssignment(ctx *Context, repo *models.Repository) { | |||
|
|||
if repo.IsMirror { | |||
var err error | |||
ctx.Repo.Mirror, err = models.GetMirrorByRepoID(repo.ID) | |||
mirror, err := repo_model.GetMirrorByRepoID(repo.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes #18204
In go-gitea#17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that attempting change mirror settings results in an NPE. This PR simply restores this. Either we should remove this field or, we should set it. At present it seems simplest to set it instead of going looking in the Data for the value although converting the context to a bag of things may be the correct approach in the future. Fix go-gitea#18204 Signed-off-by: Andrew Thornton <[email protected]>
In #17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that attempting change mirror settings results in an NPE. This PR simply restores this. Either we should remove this field or, we should set it. At present it seems simplest to set it instead of going looking in the Data for the value although converting the context to a bag of things may be the correct approach in the future. Fix #18204 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
In go-gitea#17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that attempting change mirror settings results in an NPE. This PR simply restores this. Either we should remove this field or, we should set it. At present it seems simplest to set it instead of going looking in the Data for the value although converting the context to a bag of things may be the correct approach in the future. Fix go-gitea#18204 Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
This is the first step to move repository related beans. To make it review easier, I will put others in future PRs.