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
git-diff-filter ignored when no changes to src/ #1599
Comments
Hello but what do you expect from Infection when only typescript files are changed in
As a workaround, if you choose the point 1, without any changes on Infection side, you can prepare a diff yourself and do not run Infection if only other solution is to provide new option for Infection to grep not by hardcoded for example:
|
I expected option 1 to occur, ie. it runs Option 3 is what is currently happening, so that's not what I would have expected. I think the suggestion of providing a |
This indeed requires more thinking, but I will put 2 ideas for future so they can be analyzed:
I like the second idea for the simplicity. It will be a BC break, but since we are on |
…rns empty result (no files to be mutated) Fixes #1599 This will improve the speed of CI builds and immediately stop Infection execution. Example: if `README.md` is updated on the root of the folder, we don't want/need to run Infection against the whole project.
See #1600 if it helps |
…rns empty result (#1600) * Use Symfony's `Process::fromShellCommandLin()` to execute a command * Stop Infection execution with `0` exit code when git diff filter returns empty result (no files to be mutated) * Stop Infection execution with `0` exit code when git diff filter returns empty result (no files to be mutated) Fixes #1599 This will improve the speed of CI builds and immediately stop Infection execution. Example: if `README.md` is updated on the root of the folder, we don't want/need to run Infection against the whole project. * Depending on OS, check command line differently https://www.php.net/manual/en/function.escapeshellarg.php > On Windows, escapeshellarg() instead replaces percent signs, exclamation marks (delayed variable substitution) and double quotes with spaces and adds double quotes around the string.
In our repo, we have PHP code in
src/
and TypeScript inassets/
. It's very common for branches to contain no changes tosrc/
. For branches that containsrc/
changes, thegit-diff-filter
works great, and cuts ~4m from our build time. However for branches that don't; the filter is ignored and all mutations are generated.Looking at the
GitDiffFileProvider
and running the underlying command on the different branches we get something like this:With
src/
changes:Without
src/
We run infection with the following command after manually running our test suite with coverage:
Looking at
infection/src/FileSystem/SourceFileFilter.php
Line 92 in 84140e6
src/
changes is treated the same as not specifying any filters. Is there a way we make the SourceFileFilter differentiate between these two cases?The text was updated successfully, but these errors were encountered: