Skip to content

Commit da0cca8

Browse files
authored
Merge pull request #975 from endjin/feature/974
Exclude base commit when getting intermediate commits.
2 parents 08ace6f + 89c10e8 commit da0cca8

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
@@ -104,11 +104,11 @@ private static IEnumerable<Commit> GetIntermediateCommits(IRepository repo, Comm
104104
var found = false;
105105
foreach (var commit in intermediateCommitCache)
106106
{
107-
if (commit.Sha == baseCommit.Sha)
108-
found = true;
109-
110107
if (found)
111108
yield return commit;
109+
110+
if (commit.Sha == baseCommit.Sha)
111+
found = true;
112112
}
113113
}
114114

0 commit comments

Comments
 (0)