fix(core): use file path inside git repository in git show command #2537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use file's relative path inside git repository when running
git show
to identify affected .json files to fix an issue when nx workspace is not at the root of git repositoryCurrent Behavior (This is the behavior we have today, before the PR is merged)
When NX workspace is not located at the root of git repository and we run affected commands using git repository (with --base option), we end up with the following kind of error message.
It seems this problem occurs for .json files only.
When
defaultReadFileAtRevision
is executed,git show
command is used with the file name.In the case that NX workspace is not located at the root of git repository, the file path does not match the one inside the git repository which shows the above error.
Expected Behavior (This is the new behavior we can expect after the PR is merged)
The
git show
command is used with the file's relative path inside git repository folder and therefore the git command properly identifies the file even when NX workspace is not located at the root of git repository. (and error message is not shown anymore)Issue
Closes #2292