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-base should use merge-base instead of direct diff #1653
Comments
Let me ask if I understood the issue correctly. Given the following example from
If yes & yes, what do you think if we add this information to the docs and allow people to control it themselves? If they want to diff with Does it make sense? |
Yes, if B is HEAD then when I do We could just add something to the docs, but I'm not sure what the use case is for the direct diff between B and A. |
I think typically the diff between B and X is going to be very similar to the diff between the hypothetical commit that merges B into A and A. |
Happy to make a PR for this, could probably use some guidance since I haven't contributed to infection before. I guess there's an option to introduce a new command line argument instead of changing the behaviour of the existing one. |
awesome. I would start from here: infection/src/Logger/GitHub/GitDiffFileProvider.php Lines 55 to 76 in 4e21783
the first method is used for
I'm personally ok with updating behavior for current options. We are on |
Thanks, I'll see if I can get the PR in this weekend. |
…se (#1653) (#1654) * Use merge-base (three dot diff) instead of direct diff for git-diff-base (#1653) * Add command line dumping for debugging * Fetch full history to allow finding common ancestor, not just last commit * Remove var_dumps * Debug with git depth 1 * Fall back to direct diff if merge base commit is not avialable * Restore deep git fetch * Kill UnwrapTrim mutant
…se (infection#1653) (infection#1654) * Use merge-base (three dot diff) instead of direct diff for git-diff-base (infection#1653) * Add command line dumping for debugging * Fetch full history to allow finding common ancestor, not just last commit * Remove var_dumps * Debug with git depth 1 * Fall back to direct diff if merge base commit is not avialable * Restore deep git fetch * Kill UnwrapTrim mutant
#1655) * Use merge-base (three dot diff) instead of direct diff for git-diff-ase (#1653) (#1654) * Use merge-base (three dot diff) instead of direct diff for git-diff-base (#1653) * Add command line dumping for debugging * Fetch full history to allow finding common ancestor, not just last commit * Remove var_dumps * Debug with git depth 1 * Fall back to direct diff if merge base commit is not avialable * Restore deep git fetch * Kill UnwrapTrim mutant * Fix php parse error * Add test_it_falls_back_to_direct_diff_if_merge_base_is_not_availabe * Skip test on Windows
I'm not sure whether this should be classified as a bug or a change request. The docs don't seem to specify exactly what the behaviour should be.
Currently when using
--git-diff-base=master
infection seems to be generating mutants for any lines that appear in a direct diff between HEAD and master. I think instead it should use a diff between HEAD and the merge-base of HEAD and master - i.e. the diff you see on a github pull request.We are trying out infection to give us an automatic critique of work done in PRs, and it's confusing when this includes stuff that changed on master because of an unrelated PR.
I can work around the issue for now by running
git merge-base HEAD origin/master
and passing the output of that to the CLI param.The text was updated successfully, but these errors were encountered: