Skip to content

Commit

Permalink
Exclude base commit when getting intermediate commits. #974
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeEvansLarah authored and JakeGinnivan committed Jul 26, 2016
1 parent de4544b commit 9756b9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,24 @@ public void CanUseCommitMessagesToBumpVersion()
}

}

[Test]
public void CanUseCommitMessagesToBumpVersionBaseVersionTagIsAppliedToSameCommit()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.MakeATaggedCommit("1.0.0");
fixture.Repository.MakeACommit("+semver:minor");
fixture.AssertFullSemver("1.1.0+1");

fixture.ApplyTag("2.0.0");

fixture.Repository.MakeACommit("Hello");

// Default bump is patch

fixture.AssertFullSemver("2.0.1+1");
}
}
}
6 changes: 3 additions & 3 deletions src/GitVersionCore/IncrementStrategyFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ private static IEnumerable<Commit> GetIntermediateCommits(IRepository repo, Comm
var found = false;
foreach (var commit in intermediateCommitCache)
{
if (commit.Sha == baseCommit.Sha)
found = true;

if (found)
yield return commit;

if (commit.Sha == baseCommit.Sha)
found = true;
}
}

Expand Down

0 comments on commit 9756b9d

Please sign in to comment.