@@ -16,6 +16,7 @@ import (
16
16
"code.gitea.io/gitea/models/db"
17
17
"code.gitea.io/gitea/models/unit"
18
18
user_model "code.gitea.io/gitea/models/user"
19
+ "code.gitea.io/gitea/modules/base"
19
20
"code.gitea.io/gitea/modules/log"
20
21
"code.gitea.io/gitea/modules/markup"
21
22
"code.gitea.io/gitea/modules/setting"
@@ -112,6 +113,17 @@ const (
112
113
RepositoryBroken // repository is in a permanently broken state
113
114
)
114
115
116
+ // SizeDetails represents size of each part for a Repository
117
+ type SizeDetails struct {
118
+ GitSize int64
119
+ LFSSize int64
120
+ // TODO: size of more parts.
121
+ }
122
+
123
+ func (s SizeDetails ) String () string {
124
+ return fmt .Sprintf ("git: " + base .FileSize (s .GitSize ) + ", lfs: " + base .FileSize (s .LFSSize ))
125
+ }
126
+
115
127
// Repository represents a git repository.
116
128
type Repository struct {
117
129
ID int64 `xorm:"pk autoincr"`
@@ -157,14 +169,13 @@ type Repository struct {
157
169
Units []* RepoUnit `xorm:"-"`
158
170
PrimaryLanguage * LanguageStat `xorm:"-"`
159
171
160
- IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
161
- ForkID int64 `xorm:"INDEX"`
162
- BaseRepo * Repository `xorm:"-"`
163
- IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"`
164
- TemplateID int64 `xorm:"INDEX"`
165
- // the size of git repository directory itself, not include lfs/package/attachment size
172
+ IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
173
+ ForkID int64 `xorm:"INDEX"`
174
+ BaseRepo * Repository `xorm:"-"`
175
+ IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"`
176
+ TemplateID int64 `xorm:"INDEX"`
166
177
Size int64 `xorm:"NOT NULL DEFAULT 0"`
167
- LFSSize int64 `xorm:"NOT NULL DEFAULT 0 "`
178
+ SizeDetails SizeDetails `xorm:"TEXT JSON "`
168
179
CodeIndexerStatus * RepoIndexerStatus `xorm:"-"`
169
180
StatsIndexerStatus * RepoIndexerStatus `xorm:"-"`
170
181
IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"`
0 commit comments