Skip to content

Commit 66bb9e5

Browse files
committed
Feature branches should track the develop branch
A feature branch deriving from develop should be able to track develop even if develop is integrated to master via a merge commit.
1 parent 0d87102 commit 66bb9e5

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/GitVersionCore.Tests/IntegrationTests/FeatureBranchScenarios.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,49 @@ public void ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMa
170170
fixture.AssertFullSemver("1.2.0-longrunning.2");
171171
}
172172
}
173+
174+
[Test]
175+
public void FeatureBranchShouldTrackDevelopBranchIfPossible()
176+
{
177+
using (var fixture = new EmptyRepositoryFixture(new Config() { VersioningMode = VersioningMode.ContinuousDeployment }))
178+
{
179+
fixture.Repository.MakeATaggedCommit("v1.0.0");
180+
181+
fixture.Repository.CreateBranch("develop");
182+
fixture.Repository.Checkout("develop");
183+
184+
fixture.Repository.CreateBranch("feature/a-feature");
185+
fixture.Repository.Checkout("feature/a-feature");
186+
fixture.Repository.MakeACommit();
187+
188+
fixture.Repository.Checkout("develop");
189+
fixture.Repository.MergeNoFF("feature/a-feature");
190+
191+
fixture.Repository.Checkout("master");
192+
// NOTE: develop and master will diverge here when running git flow
193+
fixture.MergeNoFF("develop");
194+
// NOTE: if we're merging develop to master with fast forward, the test will pass
195+
// fixture.Repository.Merge(fixture.Repository.FindBranch("develop"), Constants.SignatureNow(), new MergeOptions() {FastForwardStrategy = FastForwardStrategy.FastForwardOnly});
196+
197+
fixture.Repository.ApplyTag("v2.0.0");
198+
199+
fixture.Repository.Checkout("develop");
200+
fixture.Repository.CreateBranch("feature/snd-feature");
201+
fixture.Repository.Checkout("feature/snd-feature");
202+
fixture.Repository.MakeACommit();
203+
204+
fixture.Repository.Checkout("develop");
205+
fixture.Repository.MakeACommit();
206+
207+
fixture.Repository.DumpGraph();
208+
209+
// NOTE: develop behaves correctly
210+
fixture.AssertFullSemver("2.1.0-unstable.1");
211+
212+
fixture.Checkout("feature/snd-feature");
213+
// NOTE: I would expect something like the assertion below
214+
fixture.AssertFullSemver("2.1.0-snd-feature.1");
215+
// BUT WAS: "1.1.0-snd-feature.3"
216+
}
217+
}
173218
}

0 commit comments

Comments
 (0)