feat: resolve increments from merged branches - #5140
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18f6910930
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e34bfa475
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4e34bfa to
f6b83bb
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6b83bb5c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
f6b83bb to
52598be
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52598be177
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
52598be to
1c8f29f
Compare
1c8f29f to
3f8211c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f8211c580
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8823790f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cee297f10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c78e8a6d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33a7ac1f36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdafb9537f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9be4f76314
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c4146240d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d79ccee85
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
You are very fast implementing things :) Thank you. It feels a little bit like prototyping. Anyway, I think the table is wrong and I was thinking to remove the complexity with the null value. I'm not sure if we really need the use case where the result will be Increment.None. From the coneptual point of view the following table would make more sense:
What do you think? |
|
I agree with the four-case table. The nullable value still has a useful role at the configuration boundary: an omitted branch value means "inherit". But it should be resolved before increment selection. I would model the selector only with the two effective booleans:
That makes This is cleaner than the current six-case implementation. I would rework the selector types and matrix tests around the resolved source value rather than add another special case. |



Description
Moves merged-branch increment selection into
IncrementStrategyFinder.DetermineIncrementedField, so every version strategy that already uses the finder receives the same behavior without adding a separate strategy or configuration surface.For a branch with merge-message tracking enabled that is either an effective main branch or a compatible descendant preserving main-branch history through linear work and main-to-descendant updates, the finder separates first-parent target work from recognized two-parent merges. It calculates each source branch's effective increment from the merged history, preserves source
+semver/=semverhandling, and applies the target/source settings as follows:of-merged-branchwhen-branch-mergedfalsefalsefalsetruefalsenulltruefalsetruetruetruenullMain-to-descendant update merges carry main's recursively derived version floor rather than treating main as a completed source branch. Unrelated intervening merges still keep the descendant outside merge-history processing.
Direct target commits still contribute the target increment, unrecognized merge histories remain target-configured work, synthetic pull-request refs stay outside merge-history processing, and the highest contribution across multiple merges wins. Inherited source increments are resolved from the historical merged tip, including deleted or recreated topic refs and source branches that absorb the topic later. Per-merge and ancestry results use configuration-aware cache keys because the finder evaluates multiple base-version candidates for the same current commit.
Related Issue
Resolves #4433
Motivation and Context
Outside mainline calculation, a no-fast-forward merge currently falls back to the target branch's configured increment. This makes a patch hotfix merged into a minor-increment main branch produce a minor version, and a minor feature merged into a patch-increment main branch produce a patch version. The increment finder already owns configured and commit-message increment precedence, so handling merged histories there keeps the behavior consistent across dependent version strategies.
How Has This Been Tested?
Tested on Linux with .NET SDK 10.0.400 at
85ea15ee4:Inheritskipping.IncrementStrategyFinderunit case proving that commit-message cache entries are isolated by regex configuration.dotnet build ./src/GitVersion.slnx --no-incremental— succeeded with 0 warnings and 0 errors.dotnet test --solution ./src/GitVersion.slnx --no-build --output Normal --no-progresswithTMPDIRset to a clean non-repository directory and local parallelism capped at 4 — 37,292 succeeded, 0 failed.dotnet format ./src/ --exclude "**/AddFormats/" --verify-no-changes --no-restore— succeeded.git diff --check— succeeded.Screenshots (if appropriate):
N/A
Checklist: