Skip to content

Commit

Permalink
Update MainlineVersionCalculator.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
FISHMANPET committed Jul 14, 2020
1 parent f6382f4 commit c701080
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,25 @@ public SemanticVersion FindMainlineModeVersion(BaseVersion baseVersion)
var mainlineCommitLog = repositoryMetadataProvider.GetMainlineCommitLog(baseVersion.BaseVersionSource, mainlineTip);
var directCommits = new List<Commit>(mainlineCommitLog.Count);

// Scans commit log in reverse, aggregating merge commits
foreach (var commit in mainlineCommitLog)
if (string.IsNullOrEmpty(context.Configuration.NextVersion))
{
directCommits.Add(commit);
if (commit.Parents.Count() > 1)
// Scans commit log in reverse, aggregating merge commits
foreach (var commit in mainlineCommitLog)
{
mainlineVersion = AggregateMergeCommitIncrement(commit, directCommits, mainlineVersion, mainline);
directCommits.Add(commit);
if (commit.Parents.Count() > 1)
{
mainlineVersion = AggregateMergeCommitIncrement(commit, directCommits, mainlineVersion, mainline);
}
}
}

// This will increment for any direct commits on mainline
mainlineVersion = IncrementForEachCommit(directCommits, mainlineVersion, mainline);
// This will increment for any direct commits on mainline
mainlineVersion = IncrementForEachCommit(directCommits, mainlineVersion, mainline);
}
mainlineVersion.BuildMetaData = CreateVersionBuildMetaData(mergeBase);

// branches other than master always get a bump for the act of branching
if (!context.CurrentBranch.IsSameBranch(mainline))
if ((!context.CurrentBranch.IsSameBranch(mainline)) && (string.IsNullOrEmpty(context.Configuration.NextVersion)))
{
var branchIncrement = FindMessageIncrement(null, context.CurrentCommit, mergeBase, mainlineCommitLog);
log.Info($"Performing {branchIncrement} increment for current branch ");
Expand Down

0 comments on commit c701080

Please sign in to comment.