-
-
Notifications
You must be signed in to change notification settings - Fork 241
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 listing of modified files #3472
Conversation
Consider the merge-base commit as the starting point of diff instead of listing all differences between branches.
The test failed after 5e1adac because of a missing merge base which I fixed by adding |
it seems everything is working :) We'll merge this one once the current CI issue with eslint-plugin-json is fixed :) |
Thanks @nvuillam , which issue are you referring to? |
@vkucera it's fixed, i merge once CI is ok (and it should be ^^ ) |
Consider the merge-base commit as the starting point of diff instead of listing all differences between branches.
Fixes #2125
Proposed Changes
MegaLinter currently gets the list of files to check by comparing
HEAD
and the base branch.pull_request
events whereHEAD
is the merge commit andgit diff
only lists files in the PR.push
events where the base branch can contain commits not present in the head branch andgit diff
also lists files from those commits.To list only files from commits in the head branch which are not present in the base branch, one should run
git diff
against the common ancestor (aka merge-base) of the two branches.This can be done with
git diff <base-branch>...
which is equivalent to:git diff <base-branch>...HEAD
git diff --merge-base <base-branch> HEAD
git diff $(git merge-base <base-branch> HEAD) HEAD
Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance