Repository navigation
Prevent file paths from being parsed as tool options - #1234
Merged
Merged
Conversation
Tasks pass repository files as separate arguments to external tools, so a file named like "--config=x.php" was read as an option. Paths starting with "-" are now prefixed with "./". A "--" separator is not used because not every tool supports it and several tasks append options such as "--fix" after the file list. git_blacklist now runs with --literal-pathspecs, so a file name starting with ":" is no longer read as pathspec magic.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
GrumPHP passes repository files as separate arguments to the external tools it runs. A file whose name starts with
-, such as--config=other.php, was read by the tool as an option instead of a path. Paths starting with-now get a./prefix in ProcessArgumentsCollection, which covers every task that passes files this way. I didn't use a--separator because not every wrapped tool supports it, and several tasks append options like--fixafter the file list.The git_blacklist task now runs git with
--literal-pathspecs, so a file name starting with:is no longer read as pathspec magic, and a file with a leading-no longer makes git grep fail.The new E2E tests also run on AppVeyor to confirm the prefixed paths resolve on Windows.