Prevent Older commits on PR blocking merge that new commits already overrides - #2386
Merged
Conversation
…verride If you have a PR open for some time, we shouldn't need to rebase to address the merge issue as long as the top-level script version changed. Therefore, as long as we have a newer commit already adjusting the top-level script, we shouldn't need to check it out again on older commits in this PR that we are processing
dpaulson45
force-pushed
the
dpaul-UpdateValidateMerge
branch
from
August 14, 2025 14:14
322c42a to
6c1851d
Compare
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bill-long
approved these changes
Aug 14, 2025
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.
Issue:
To allow a large change of a PR that has been open for some time where you have smaller PRs to merge into it to make the commits to line up with the PR that they were created in and linked to, you don't want to rebase that main branch. You want to do this with a large change and have smaller PRs to line up with some changes to make it easier for code review and understanding down the road vs having everything being linked to a single PR.
Example PR: #2295
Reason:
If you have a PR open for some time, we shouldn't need to rebase to address the merge issue as long as the top-level script version changed. Therefore, as long as we have a newer commit already adjusting the top-level script, we shouldn't need to check it out again on older commits in this PR that we are processing
Fix:
Once a top-level script has been changed for a version by a commit in the PR, an older commit in this PR is irrelevant if we have files within the top-level script down that aren't newer than that older commit.
By doing it this way, we also avoid seeing the same file being complained about if we the same top-level script being evaluated in multiple commits.
This also greatly improves the performance of the script as well. Before this change the script will evaluate every commit and the top level scripts that it modifies down every time. By skipping over those commits of the top level script that we already evaluated, we took the script from processing the script of about 20 mins to 2 mins.
Resolved #2372
Validation:
Tested against the example PR by doing some test commits on some of the files that the current
ValidateMerge.ps1complains about, then we no longer see those files in the commit.Before changes to
ValidateMerge.ps1but still including the commit that will clear up a lot of problems after the change as well to just showcase that we have a newer commit that will not block for exampleD:\GitHub\CSS-Exchange\Admin\Test-AMSI.ps1from merging.After the current commit to
ValidateMerge.ps1:After the test commit, we dropped files that were related to the previous merge blocking.