Skip to content

"Rebase then FF" merged PR is misidentified as Squash-Merged #213

Description

@BtbN

This is happening on our Forgejo instance, but I believe the exact same issue would happen on GitHub with its Rebase-Merge style, which is basically identical.

In https://github.com/kiegroup/git-backporting/blob/main/src/service/git/github/github-client.ts#L49 and then https://github.com/kiegroup/git-backporting/blob/main/src/service/git/git-util.ts#L51 what the logical basically does is:

If the PR is:

  • closed
  • its merge_commit_sha commit only has one parent
  • that merge_commit_sha is different than the HEAD commit sha of the PR

Then ultimately inferSquash() returns true, and as a result, only the HEAD commit of the PR is cherry-picked.

The only problem is: All those conditions are also true for a pull request that was "Rebase then ff" merged.
It's closed, the merge commit only has one parent, and unless the PR was fully up to date, it will be different than the PR head sha.

I'm not immediately sure how else to properly detect a squash-merged PR vs. a rebase merged one, but the current logic misidentifies rebase+ff merged ones, and misses potentially all but one commit from them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions