-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
models: include LFS when calculating repo size #11060
Conversation
LFS size should probably be saved in other field imho, also it should include migration to add that to existing repos |
Is there any use case for that? In my case, when I want to limit user for specific size, then I expect repo.Size will return the whole consumed storage of repo. |
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.
split lfs size in a seperate var has it's up and downs.
so as long as we do not explicit need to split this up (because of a feature e.g. ...) we can leafe it by adding lfs to normal repo size
@lafriks do you have a feature/function already in mind?
The test failed looks weird. |
Codecov Report
@@ Coverage Diff @@
## master #11060 +/- ##
=======================================
Coverage 43.46% 43.47%
=======================================
Files 597 597
Lines 84706 84738 +32
=======================================
+ Hits 36821 36840 +19
- Misses 43344 43351 +7
- Partials 4541 4547 +6
Continue to review full report at Codecov.
|
@6543 your approval is black, is it problem? |
We should split them so that we could allow different limits for git repository size and lfs |
Currently, LFS is transparent with user, so I don't think it's worth to split them yet. We can easily do it in the future, if necessary. |
no it just means I cant merge |
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.
We should may be add tests for repo.Size but those are not currently existing. Otherwise LGTM.
This PR will close one item of #7833. For including or not lfs object in .Size or in a specific field, I think it should be included (as .Size is the global size) and if needed two specific fields could be added for git and lfs specific size info. |
I also like the idea of having separate values for the size. LFS objects might be shared among repositories and reside in different places (e.g. cloud storage), which in turn can result in separate policies, so it makes sense to count them separately (and we can display them in the UI as well). |
I did add a test in |
@cuonglm Yes that is good enough. It is a more broad problem (and previously existing). Currently the only solution to force the updateSize and the size fields to be calculated is to update object in the repo. |
@cuonglm I think we could split the size in future PRs. |
ping LG-TM |
Fixes go-gitea#9369 Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Does this change affect #3658 ? |
@@ -806,6 +806,14 @@ func (repo *Repository) updateSize(e Engine) error { | |||
return fmt.Errorf("updateSize: %v", err) | |||
} | |||
|
|||
objs, err := repo.GetLFSMetaObjects(-1, 0) |
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.
A select sum sql is better than this change.
Fixes #9369