forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid re-scanning directories when searching for READMEs.
When rendering a directory's README we have scanned its Tree once, looking for the README; but we allow READMEs in some special subfolders too (docs/, .gitea/, .github/), and may need to scan them. Since we've already scanned the top Tree, we have the subfolders' SHA1 object IDs cached, so, as a minor optimization, instead of calling SubTree(path string), which re-scans the Tree before using Repository.getTree() to actually produce their Tree objects, call Repository.getTree() directly. But it's a private method, so first expose it via new TreeEntry.Tree(). Feedback from @lunny: https://github.com/go-gitea/gitea/pull/22177/files#r1053953034
- Loading branch information
Showing
2 changed files
with
47 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters