Skip to content

Should inherit prevent version increment as well #394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2015
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
17 changes: 17 additions & 0 deletions GitVersionCore.Tests/IntegrationTests/PullRequestScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,21 @@ public void CanCalculatePullRequestChangesInheritingConfigFromRemoteRepo()
fixture.AssertFullSemver("0.2.0-PullRequest.2+3");
}
}

[Test]
public void CalculatesCorrectVersionAfterReleaseBranchMergedToMaster()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.MakeACommit();
fixture.Repository.CreateBranch("release/2.0.0").Checkout();
fixture.Repository.MakeACommit();
fixture.Repository.MakeACommit();

fixture.Repository.CreatePullRequest("release/2.0.0", "master");

fixture.AssertFullSemver("2.0.0-PullRequest.2+0");
}
}
}
8 changes: 6 additions & 2 deletions GitVersionCore/BranchConfigurationCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(

if (possibleParents.Count == 1)
{
var branchConfig = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, possibleParents[0]).Value;
return new KeyValuePair<string, BranchConfig>(
keyValuePair.Key,
new BranchConfig(branchConfiguration)
{
Increment = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, possibleParents[0]).Value.Increment
Increment = branchConfig.Increment,
PreventIncrementOfMergedBranchVersion = branchConfig.PreventIncrementOfMergedBranchVersion
});
}

Expand All @@ -109,11 +111,13 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(
var branchName = hasDevelop ? "develop" : "master";

Logger.WriteWarning(errorMessage + Environment.NewLine + Environment.NewLine + "Falling back to " + branchName + " branch config");
var value = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, repository.Branches[branchName]).Value;
return new KeyValuePair<string, BranchConfig>(
keyValuePair.Key,
new BranchConfig(branchConfiguration)
{
Increment = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, repository.Branches[branchName]).Value.Increment
Increment = value.Increment,
PreventIncrementOfMergedBranchVersion = value.PreventIncrementOfMergedBranchVersion
});
}
}
Expand Down