From 0168b53708e237efad892b641a4118ad0c7e504a Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Mon, 13 Apr 2020 21:28:12 +0700 Subject: [PATCH] models: include LFS when calculating repo size Fixes #9369 --- models/repo.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/models/repo.go b/models/repo.go index f79740e747588..98972894c1410 100644 --- a/models/repo.go +++ b/models/repo.go @@ -781,6 +781,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