DEVPROD-13619 Use merge base as base revision for PR patches #8658
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.
DEVPROD-13619
Description
The ${revision} expansion is not guaranteed to be part of the git history when checking out the PR branch, if the changes from the PR diverged off of an earlier commit. So running
git reset --hard ${revision}
in a task might check out a revision that other tasks in the version are not running on.Testing
I recreated the issue in staging, where a sandbox branch diverged from commit
a83c6e5
, and before I created a PR from that branch, I added a new commit on main. I configured one task to just run a regulargit log --oneline -n 10
, and another task to run agit reset --hard ${revision} && git log --oneline -n 10
.Before the change, the task that performs reset --hard starts at the newer commit that was added after the PR branch was created (
a702ad8
), whereas the task that does not starts at the correct merge base,a83c6e5
.After the change, the task that performs reset --hard and the one that does not both start at
a83c6e5
in their history.Documentation
Tweaked the docs