-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(jpath): support nested calling again #456
Conversation
Originally, Tanka was able to find the environments entrypoint, even when it was actually called on a directory that is nested underneath that environment. This was modeled after the ability to use `git` commands anywhere in the project. This functionality was lost however in a recent PR. While restoring it, I took the chance to do a long overdue refactoring of the `jpath` package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add a unit test this to ensure that this functionality is not lost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work.
root, err := FindParentFile("tkrc.yaml", start, stop) | ||
if err == nil { | ||
return root, nil | ||
} | ||
|
||
// otherwise use jsonnetfile.json | ||
root, err = FindParentFile("jsonnetfile.json", start, stop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can we have a list of parentFiles []string
and iterate over it? It could make the jsonnet/jpath
API a bit more flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would that go? I would not want every callee of jpath.Resolve
or jpath.FindRoot
have to specify that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging, we can address that later if we wish to
Originally, Tanka was able to find the environments entrypoint, even when it was actually called on a directory that is nested underneath that environment.
This was modeled after the ability to use
git
commands anywhere in the project.This functionality was lost however in a recent PR (#389)
While restoring it, I took the chance to do a long overdue refactoring of the
jpath
package.