Skip to content
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

[Bug] Version not generated correct when creating a feature branch from a develop branch #3108

Closed
HHobeck opened this issue May 4, 2022 · 7 comments
Labels
Milestone

Comments

@HHobeck
Copy link
Contributor

HHobeck commented May 4, 2022

Describe the bug
Hi there. I'm using the GitFlow branching strategy descripted on this page https://gitversion.net/docs/learn/branching-strategies/gitflow/examples. Because I want to ensure the stability of the develop direct committing is not allowed. Thus I need to go via feature branches and got an unexpected version generation on the following scenario:

[Test]
public void __Just_A_Test__()
{
    using var fixture = new EmptyRepositoryFixture();
    fixture.Repository.MakeATaggedCommit("1.0.0");
    fixture.BranchTo("develop");
    fixture.Repository.MakeACommit();
    fixture.Checkout("main");
    fixture.Repository.MakeACommit();
    fixture.Checkout("develop");
    fixture.BranchTo("feature/just-a-test");
    fixture.MergeNoFF("main");
    fixture.Repository.MakeACommit();
    var configuration = new Config()
    {
        Branches = new Dictionary<string, BranchConfig>()
        {
            { "release", new BranchConfig() { TracksReleaseBranches = true } }
        }
    };
    fixture.AssertFullSemver("1.0.1-just-a-test.1+4", configuration); // expected 1.1.0
}

That produces the following repository:

 * 1d22aeb 51 minutes ago  (HEAD -> feature/just-a-test)
 *   cb3fd3c 53 minutes ago 
 |\  
 | * 3df53ce 54 minutes ago  (main)
 * | e2ca7c9 56 minutes ago  (develop)
 |/  
 * 46ab60b 58 minutes ago  (tag: 1.0.0)

with following commit messages:
image

Expected Behavior

Git Version should generate the semantic version 1.1.0 on feature branch just-a-test in this scenario.

Actual Behavior

The semantic version 1.0.1 will be generated.

Possible Fix

I'm not sure if it is a bug or I have misconfigured something.

Steps to Reproduce

Please take look to the test steps above

Context

I'm using the latest version of GitVersion 5.10.1. My build and deployment pipelines are in AzureDevOps but I can reproduce it locally.

Your Environment

  • Version Used: 5.10.1
  • Operating System is Windows 10
  • Link to your project: n/a
  • Link to your CI build (if appropriate): n/a
@HHobeck HHobeck added the bug label May 4, 2022
@asbjornu
Copy link
Member

asbjornu commented Sep 2, 2022

I believe the problem is that you don't have any commits on develop and feature/just-a-test. If I add commits to the branches, I get a result closer to your expectation:

[Test]
public void __Just_A_Test__()
{
    using var fixture = new EmptyRepositoryFixture();
    fixture.Repository.MakeATaggedCommit("1.0.0");
    fixture.BranchTo("develop");
    fixture.Repository.MakeACommit();
    fixture.Checkout("main");
    fixture.Repository.MakeACommit();
    fixture.Checkout("develop");
    fixture.Repository.MakeACommit();
    fixture.BranchTo("feature/just-a-test");
    fixture.Repository.MakeACommit();
    fixture.MergeNoFF("main");
    fixture.Repository.MakeACommit();
    var configuration = new Config()
    {
        Branches = new Dictionary<string, BranchConfig>()
        {
            { "release", new BranchConfig() { TracksReleaseBranches = true } }
        }
    };
    fixture.AssertFullSemver("1.1.0-just-a-test.1+6", configuration);
}

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Mar 4, 2023
@HHobeck
Copy link
Contributor Author

HHobeck commented Mar 31, 2023

The problem is clear of course git-version doesn’t know which branch the right branch is to use. Because we have two parents on the one hand the main and on the other hand the develop branch. GitVersion takes properly the branch which was least committed. But is this behavior correct? Your proposal gives me the correct number but from the ci pipeline point of view it is not possible because the develop branch is restricted to check-in directly. Thus everything must go via a PR to ensure the stability of the branch. This scenario makes sense, doesn't it?

@HHobeck HHobeck removed the stale label Mar 31, 2023
@HHobeck HHobeck added this to the 6.x milestone Mar 31, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Jun 29, 2023
@arturcic arturcic removed the stale label Jun 30, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Sep 29, 2023
@arturcic arturcic removed the stale label Sep 29, 2023
@arturcic arturcic added stale and removed stale labels Oct 30, 2023
@HHobeck
Copy link
Contributor Author

HHobeck commented Jan 28, 2024

The trick is to specify the feature branch with increment minor not inherit.

@HHobeck HHobeck closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2024
@arturcic arturcic modified the milestones: 6.x, 6.0.0-beta.6 Mar 9, 2024
@arturcic
Copy link
Member

arturcic commented Mar 9, 2024

🎉 This issue has been resolved in version 6.0.0-beta.6 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants