graphql-tools
graphql-tools copied to clipboard
[git-loader]: `resolveGlobs` breaks with leading `./` in path
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches yours. - [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
The GitLoader.load() method breaks when a path is provided with a leading ./, which is required when run in a subdirectory, as often is the case with monorepos.
It ends up with errors like:
> graphql-inspector diff "git:develop:./a/b.graphql" ...
error Error: Unable to load file from git: Error: Command failed: git show develop:a/b.graphql
fatal: path 'x/y/a/b.graphql' exists, but not 'a/b.graphql'
hint: Did you mean 'develop:x/y/a/b.graphql' aka 'develop:./a/b.graphql'?
To Reproduce Steps to reproduce the behavior:
n/a
Expected behavior
Git file lookup should work when invoked in a subdirectory.
Environment:
n/a
Additional context
I noticed the issue in the graphql-inspector package and traced it back to here.