From c08e42c47ef2a32b3b7ee422c73d6929c93b199e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 8 Oct 2022 01:20:53 +0800 Subject: Refactor parseTreeEntries, speed up tree list (#21368) Close #20315 (fix the panic when parsing invalid input), Speed up #20231 (use ls-tree without size field) Introduce ListEntriesRecursiveFast (ls-tree without size) and ListEntriesRecursiveWithSize (ls-tree with size) --- services/repository/files/tree.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services/repository/files/tree.go') diff --git a/services/repository/files/tree.go b/services/repository/files/tree.go index caad732887..59e5690977 100644 --- a/services/repository/files/tree.go +++ b/services/repository/files/tree.go @@ -29,7 +29,7 @@ func GetTreeBySHA(ctx context.Context, repo *repo_model.Repository, gitRepo *git tree.URL = repo.APIURL() + "/git/trees/" + url.PathEscape(tree.SHA) var entries git.Entries if recursive { - entries, err = gitTree.ListEntriesRecursive() + entries, err = gitTree.ListEntriesRecursiveWithSize() } else { entries, err = gitTree.ListEntries() } -- cgit v1.2.3