Skip to content
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

DEVPROD-13619 Use merge base as base revision for PR patches #8658

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hadjri
Copy link
Contributor

@hadjri hadjri commented Jan 22, 2025

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.

  • Always fetch the merge base for a PR patch, not just when OldestAllowedMergeBase is set
  • Use that merge base as the revision for the created version

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 regular git log --oneline -n 10, and another task to run a git 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

@hadjri hadjri requested a review from a team January 22, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant