Skip to content
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,19 @@
using GitVersion.Configuration;
using GitVersion.VersionCalculation.Mainline;

namespace GitVersion.Core.Tests.VersionCalculation;

[TestFixture]
public class MainlineIterationTests
{
[Test]
public void ChildIsDeeperThanParent()
{
var configuration = new BranchConfiguration();
var parent = new MainlineIteration("id0", new("canonical0"), configuration, null, null);
var child = new MainlineIteration("id1", new("canonical1"), configuration, parent, null);

parent.Depth.ShouldBe(1);
child.Depth.ShouldBe(2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public MainlineIteration(string id, ReferenceName branchName, IBranchConfigurati
MainlineIteration? parentIteration, MainlineCommit? parentCommit)
{
Id = id.NotNullOrEmpty();
Depth = parentIteration?.Depth ?? 0 + 1;
Depth = (parentIteration?.Depth ?? 0) + 1;
BranchName = branchName.NotNull();
Configuration = configuration.NotNull();
ParentIteration = parentIteration;
Expand Down
Loading