Skip to content

Extend git flow complex example to post merge and rebase behaviour #4585

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

9swampy
Copy link
Contributor

@9swampy 9swampy commented Jun 21, 2025

Description

Extend the GitFlowComplexExample to document unexpected post merge and rebase behaviour.
Fix the integration test fixtures so they can accept a "master" main branch instead of hardcoding "main".

Related Issue

Motivation and Context

I have been really struggling to get GitVersion to work post the v6 changes so I checked out the repo to run through sample scenarios to try and adapt but I either need more documentation to understand what the new behaviour is or the new behaviour is possibly unintended.

Rather than just rely on the Integration tests with injected configuration, I wanted to be able to revisit the repository that is created by the integration test and I observe

  1. Inconsistent behaviour between the TestFixture and when running dotnet-gitversion against GitVersion.yml output by the test fixture (problem number 1 documented in the penultimate commit in the amended GitFlowComplexExample - I set this assertion to pass but behaviour in the test does not match behaviour observed with dotnet-gitversion 6.3.0 and a persisted GitVersion.yml)
  2. Consistent but unanticipated behaviour on a rebase (problem number 2 which is the current failure in the amended GitFlowComplexExample)

How Has This Been Tested?

GitFlowComplexExample

Screenshots (if appropriate):

image

Checklist:

This is a WIP proposal to document a problem & ask for help; if I get direction I'm happy to update the PR as offered/advised.

  • 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.

@9swampy 9swampy force-pushed the ExtendGitFlowComplexExampleToPostMergeAndRebaseBehaviour branch from 1586c8e to 45f96cc Compare June 21, 2025 18:36
@asbjornu asbjornu modified the milestone: 6.x Jun 24, 2025
@asbjornu asbjornu requested a review from HHobeck June 24, 2025 09:45
@asbjornu
Copy link
Member

@HHobeck, I think these changes look reasonable. What are your thoughts on this?

@@ -7,7 +7,7 @@ namespace GitVersion.Core.Tests.Helpers;

public class TestBase
{
public const string MainBranch = "main";
public const string MainBranch = RepositoryFixtureBase.MainBranch;
Copy link
Contributor Author

@9swampy 9swampy Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4589 Magic strings >> BranchConfigurationKey.

fixture.MakeACommit(
"feature 2 additional commit after original feature has been merged to develop " + System.Environment.NewLine +
$"and release/1.2.0 has already happened >> {fullSemver}" +
"Problem #1: 1.3.0-f2.1+0 is what I observe when I run dotnet-gitversion 6.3.0 but in the repo the assertion is 1.3.0-f2.1+1" +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem 1:

  • 1.3.0-f2.1+1 is what the test asserts
  • 1.3.0-f2.1+0 is what I observe when I run dotnet-gitversion 6.3.0

$"and release/1.2.0 has already happened >> {fullSemver}" +
"Problem #1: 1.3.0-f2.1+0 is what I observe when I run dotnet-gitversion 6.3.0 but in the repo the assertion is 1.3.0-f2.1+1" +
"After rebase 1.3.0-f2.1+3 is both what the test asserts and what I observe when I run dotnet-gitversion 6.3.0." +
"Problem #2: I expected to get the same before and after the rebase." +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem 2:

  • Before rebase 1.3.0-f2.1+1 is what the test asserts (but not what dotnet-gitversion produces - see Problem 1).
  • After rebase 1.3.0-f2.1+3 is what both tests and dotnet-gitversion 6.3.0 produce.

I'd have anticipated1.3.0-f2.1+1 both before and after rebase, in this specific scenario.

var yaml = new ConfigurationSerializer().Serialize(concreteConfig);
const string fileName = "GitVersion.yml";
var filePath = FileSystemHelper.Path.Combine(r.Info.Path, "..", fileName);
File.WriteAllText(filePath, yaml);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally writing out the GitVersion.yml to demonstrate inconsistency between UnitTest version calculation and running dotnet-gitversion from the commandline. Refer to 2 problems in commentary.

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.

2 participants