Skip to content

fix: inherit pull request configuration from merge target - #5105

Merged
arturcic merged 2 commits into
GitTools:mainfrom
arturcic:fix/3020-pull-request-target-inheritance
Jul 31, 2026
Merged

arturcic merged 2 commits into
GitTools:mainfrom
arturcic:fix/3020-pull-request-target-inheritance

Conversation

@arturcic

Copy link
Copy Markdown
Member

Description

Synthetic pull request merge refs now inherit branch configuration from the TargetBranch captured in the merge commit message when that branch is an allowed source.

The resolver prefers a matching local branch over its origin alias, accepts a remote-only target, and retains the existing ancestry fallback when the target is absent, unmatched, or the current branch is not a pull request. The configuration reference documentation has been updated accordingly.

Related Issue

Fixes #3020

Motivation and Context

When a hotfix pull request targets a support branch, the existing ancestry search can also consider main. Its higher Minor increment wins, producing 1.1.0 instead of the expected patch version 1.0.2. Using the explicit merge target removes that unrelated candidate while keeping the general version-selection behavior unchanged.

How Has This Been Tested?

  • Added integration coverage for both local-only and combined local/remote branch layouts.
  • Added focused resolver coverage for local preference, remote-only targets, fallback behavior, and recursive inheritance.
  • Passed 36,132 functional GitVersion.Core tests.
  • Passed the repository performance scenario in isolation.
  • Built src/GitVersion.slnx with zero warnings and errors.
  • Verified formatting with dotnet format.
  • Reproduced the issue through the legacy CLI parser and syntax:
    • remote plus local refs: 1.0.2-alpha-pr2.2
    • local-only refs: 1.0.1-alpha-pr2.2

Screenshots (if appropriate):

Not applicable.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@sonarqubecloud

Copy link
Copy Markdown

@arturcic
arturcic merged commit a9de7ab into GitTools:main Jul 31, 2026
59 checks passed
@arturcic
arturcic deleted the fix/3020-pull-request-target-inheritance branch July 31, 2026 06:30
@mergify

mergify Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

This was referenced Nov 23, 2026
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.

[Bug] Closing pull request from hotfix to support failed to inherit Increment branch configuration

1 participant