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

Avoid incorrect restore-file on PRs with force pushes #5849

Closed
wants to merge 1 commit into from

Conversation

fregante
Copy link
Member

@fregante fregante commented Jul 22, 2022

This fixes a GitHub bug related to force pushes:

Note: API v4 repository.pullRequest.baseRefOid falls out out of date after an "update branch" + force push

Repro

  1. Create PR modifying a file
  2. Modify the same file on main
  3. "Update branch" on PR (this updates the baseRefOid)
  4. Undo commit and force push
  5. Note: baseRefOid does not revert
  6. Restore file

I found v3’s compare API to be more reliable, but this needs to be tested further.

Test URLs

@fregante fregante added the bug label Jul 22, 2022
@fregante
Copy link
Member Author

Nope… failing for a regular update branch + restore file sequence

@fregante
Copy link
Member Author

This other feature needs to be implemented first to ensure we're getting the file from the correct "base commit":

@fregante fregante closed this Jul 22, 2022
@fregante fregante deleted the restore-files-correctly branch July 22, 2022 16:31
@yakov116
Copy link
Member

This other feature needs to be implemented first to ensure we're getting the file from the correct "base commit":

We are doing this, so what else can be the issue?

@fregante
Copy link
Member Author

fregante commented Oct 30, 2022

I'd probably advise against losing time on this.

The issue I found was on GitHub's side. I think the sequence to break it was:

  1. Commit A
  2. Merge
  3. Force push back to commit A

The API reports the new base ("no merge needed") but it's not right.

My suggestion was to implement the other feature first to make these kind of bugs immediately visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

restore-file occasionally restores the wrong commit
2 participants