forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests to cover GitTree resolver (sourcegraph#57671)
I wanted to look into this resolver because it seemed to cause a lot of load on S2 and dotcom. Looking at it, I realize that there are zero tests so I didn't even know what's expected to be returned here. This PR adds a baseline for what should be returned and fixed a bunch of bugs: - Improper argument validation that could cause panics - Improperly counted results for `first` argument - Removed arguments from GraphQL schema that weren't actually respected - Fix line ending handling in content pagination to return indication if file ended with no newline - Fix TotalLines for files without a final newline - Improves performance of line parsing - Fix ancestors option creating too many results by recursively including all children into the set again (was able to get 90000 entries returned from S2 for a relatively small folder structure) - Make behavior of recursiveSingleChild match what's documented in GraphQL. Before we would only recurse if the looked at entry is a single child (or first:1 was set) Ultimately, the dir traversal we do in here should IMO happen in gitserver directly where we already have it in tree structure, but that will have to be for later. For now, this mostly adds some confidence to these resolvers.
- Loading branch information
Showing
7 changed files
with
691 additions
and
181 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
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
Oops, something went wrong.