Skip to content

Commit

Permalink
models: include LFS when calculating repo size (go-gitea#11060)
Browse files Browse the repository at this point in the history
Fixes go-gitea#9369

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
  • Loading branch information
3 people authored and Yohann Delafollye committed Jul 31, 2020
1 parent 08c74f6 commit 99ee0eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions models/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,14 @@ func (repo *Repository) updateSize(e Engine) error {
return fmt.Errorf("updateSize: %v", err)
}

objs, err := repo.GetLFSMetaObjects(-1, 0)
if err != nil {
return fmt.Errorf("updateSize: GetLFSMetaObjects: %v", err)
}
for _, obj := range objs {
size += obj.Size
}

repo.Size = size
_, err = e.ID(repo.ID).Cols("size").Update(repo)
return err
Expand Down

0 comments on commit 99ee0eb

Please sign in to comment.