Skip to content

Commit 9756b9d

Browse files
MikeEvansLarahJakeGinnivan
authored andcommitted
Exclude base commit when getting intermediate commits. #974
1 parent de4544b commit 9756b9d

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/GitVersionCore.Tests/IntegrationTests/VersionBumpingScenarios.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,24 @@ public void CanUseCommitMessagesToBumpVersion()
4343
}
4444

4545
}
46+
47+
[Test]
48+
public void CanUseCommitMessagesToBumpVersionBaseVersionTagIsAppliedToSameCommit()
49+
{
50+
using (var fixture = new EmptyRepositoryFixture())
51+
{
52+
fixture.Repository.MakeACommit();
53+
fixture.MakeATaggedCommit("1.0.0");
54+
fixture.Repository.MakeACommit("+semver:minor");
55+
fixture.AssertFullSemver("1.1.0+1");
56+
57+
fixture.ApplyTag("2.0.0");
58+
59+
fixture.Repository.MakeACommit("Hello");
60+
61+
// Default bump is patch
62+
63+
fixture.AssertFullSemver("2.0.1+1");
64+
}
65+
}
4666
}

src/GitVersionCore/IncrementStrategyFinder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ private static IEnumerable<Commit> GetIntermediateCommits(IRepository repo, Comm
9797
var found = false;
9898
foreach (var commit in intermediateCommitCache)
9999
{
100-
if (commit.Sha == baseCommit.Sha)
101-
found = true;
102-
103100
if (found)
104101
yield return commit;
102+
103+
if (commit.Sha == baseCommit.Sha)
104+
found = true;
105105
}
106106
}
107107

0 commit comments

Comments
 (0)