Skip to content

RETARGET_CHILDREN_ON_MERGE retargets branches to the main branch instead of the target of the parent branch #35138

@Zermelo-Ulbe

Description

@Zermelo-Ulbe

Description

When closing a branch in the middle of a PR chain, the target of the child PR is reset to the main branch instead of the target of the parent PR. This behavior has changed since 1.23.X.

The config cheat sheet says the target of the child branch should be set to the target of the parent branch:

RETARGET_CHILDREN_ON_MERGE: true: Retarget child pull requests to the parent pull request branch target on merge of parent pull request. It only works on merged PRs where the head and base branch target the same repo.

Reproduction

  • Start Gitea with RETARGET_CHILDREN_ON_MERGE: true
  • Create four branches and main: main, notmain, 1, 2, 3
  • Create a PR from 3 into 2, from 2 into 1, and from 1 into notmain
    • notmain < 1 < 2 < 3
  • Merge the PR from 2 into 1
    • Expected: notmain < 1 < 3
    • Actual: notmain < 1 and main < 3

Repro at https://demo.gitea.com/Zermelo-Ulbe/demo/pulls/3

Gitea Version

1.24.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Image Image Image

Git Version

No response

Operating System

No response

How are you running Gitea?

Issue occurs on https://demo.gitea.com/

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions