Skip to content

[WIP] Feature branches should track the develop branch #673

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using GitVersion;
using LibGit2Sharp;
using NUnit.Framework;
Expand Down Expand Up @@ -170,4 +171,57 @@ public void ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMa
fixture.AssertFullSemver("1.2.0-longrunning.2");
}
}

[Test]
public void FeatureBranchShouldTrackDevelopBranchIfPossible()
{
using (var fixture = new EmptyRepositoryFixture(
new Config
{
VersioningMode = VersioningMode.ContinuousDeployment,
Branches =
{
{ "feature[/-]", new BranchConfig() { TrackMergeTarget = true } }
}
}))
{
fixture.Repository.MakeATaggedCommit("v1.0.0");

fixture.Repository.CreateBranch("develop");
fixture.Repository.Checkout("develop");

fixture.Repository.CreateBranch("feature/a-feature");
fixture.Repository.Checkout("feature/a-feature");
fixture.Repository.MakeACommit();

fixture.Repository.Checkout("develop");
fixture.Repository.MergeNoFF("feature/a-feature");

fixture.Repository.Checkout("master");
// NOTE: develop and master will diverge here when running git flow
fixture.MergeNoFF("develop");
// NOTE: if we're merging develop to master with fast forward, the test will pass
// fixture.Repository.Merge(fixture.Repository.FindBranch("develop"), Constants.SignatureNow(), new MergeOptions() {FastForwardStrategy = FastForwardStrategy.FastForwardOnly});

fixture.Repository.ApplyTag("v2.0.0");

fixture.Repository.Checkout("develop");
fixture.Repository.CreateBranch("feature/snd-feature");
fixture.Repository.Checkout("feature/snd-feature");
fixture.Repository.MakeACommit();

fixture.Repository.Checkout("develop");
fixture.Repository.MakeACommit();

fixture.Repository.DumpGraph();

// NOTE: develop behaves correctly
fixture.AssertFullSemver("2.1.0-unstable.1");

fixture.Checkout("feature/snd-feature");
// NOTE: I would expect something like the assertion below
fixture.AssertFullSemver("2.1.0-snd-feature.1");
// BUT WAS: "1.1.0-snd-feature.3"
}
}
}