Skip to content

Commit 68fc846

Browse files
committed
push sha and date up
so they are in the build metadata and not the release date
1 parent 43c2849 commit 68fc846

29 files changed

+58
-83
lines changed

GitVersionCore.Tests/InformationalVersionBuilderTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using GitVersion;
23
using NUnit.Framework;
34

@@ -24,7 +25,7 @@ public void ValidateInformationalVersionBuilder(BranchType branchType, string br
2425
Minor = minor,
2526
Patch = patch,
2627
PreReleaseTag = tag,
27-
BuildMetaData = new SemanticVersionBuildMetaData(suffix, branchName, new ReleaseDate{ CommitSha = sha }),
28+
BuildMetaData = new SemanticVersionBuildMetaData(suffix, branchName, new ReleaseDate(),sha,DateTimeOffset.MinValue),
2829
};
2930
var informationalVersion = semanticVersion.ToString("i");
3031

GitVersionCore.Tests/JsonVersionBuilderTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ public void Json()
2020
{
2121
OriginalCommitSha = "originalCommitSha",
2222
OriginalDate = DateTimeOffset.Parse("2014-03-01 00:00:01Z"),
23-
CommitSha = "commitSha",
24-
Date = DateTimeOffset.Parse("2014-03-06 23:59:59Z")
25-
})
23+
}, "commitSha",DateTimeOffset.Parse("2014-03-06 23:59:59Z"))
2624
};
2725
var variables = VariableProvider.GetVariablesFor(semanticVersion);
2826
var json = JsonOutputFormatter.ToJson(variables);

GitVersionCore.Tests/VariableProviderTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ public void DevelopBranchFormatsSemVerForCiFeed()
2222
{
2323
OriginalCommitSha = "originalCommitSha",
2424
OriginalDate = DateTimeOffset.Parse("2014-03-01 00:00:01Z"),
25-
CommitSha = "commitSha",
26-
Date = DateTimeOffset.Parse("2014-03-06 23:59:59Z")
2725
};
26+
semVer.BuildMetaData.Sha = "commitSha";
27+
semVer.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z");
28+
2829

2930
var vars = VariableProvider.GetVariablesFor(semVer);
3031

GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected SemanticVersion FindVersion(
3333
PreReleaseTag = preReleaseTag,
3434
BuildMetaData = new SemanticVersionBuildMetaData(
3535
numberOfCommitsOnBranchSinceCommit,
36-
context.CurrentBranch.Name, releaseDate)
36+
context.CurrentBranch.Name, releaseDate, context.CurrentCommit.Sha, context.CurrentCommit.When())
3737
};
3838

3939
semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository);

GitVersionCore/GitFlow/BranchFinders/DevelopVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public SemanticVersion FindVersion(GitVersionContext context)
2828
Minor = versionFromMaster.Minor + 1,
2929
Patch = 0,
3030
PreReleaseTag = "unstable" + numberOfCommitsSinceRelease,
31-
BuildMetaData = new SemanticVersionBuildMetaData(numberOfCommitsSinceRelease, context.CurrentBranch.Name, releaseDate),
31+
BuildMetaData = new SemanticVersionBuildMetaData(numberOfCommitsSinceRelease, context.CurrentBranch.Name, releaseDate,tip.Sha,tip.When()),
3232
};
3333

3434
semanticVersion.OverrideVersionManuallyIfNeeded(context.Repository);

GitVersionCore/GitFlow/BranchFinders/MasterVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SemanticVersion BuildVersion(IRepository repository, Commit tip, ShortVersion sh
3939
Major = shortVersion.Major,
4040
Minor = shortVersion.Minor,
4141
Patch = shortVersion.Patch,
42-
BuildMetaData = new SemanticVersionBuildMetaData(null, "master", releaseDate)
42+
BuildMetaData = new SemanticVersionBuildMetaData(null, "master", releaseDate,tip.Sha,tip.When())
4343
};
4444
}
4545
}

GitVersionCore/GitFlow/BranchFinders/OptionallyTaggedBranchVersionFinderBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected SemanticVersion FindVersion(
3838
Patch = version.Patch,
3939
PreReleaseTag = version.PreReleaseTag,
4040
BuildMetaData = new SemanticVersionBuildMetaData(
41-
nbHotfixCommits, context.CurrentBranch.Name, releaseDate)
41+
nbHotfixCommits, context.CurrentBranch.Name, releaseDate, context.CurrentCommit.Sha, context.CurrentCommit.When())
4242
};
4343

4444
if (tagVersion != null)

GitVersionCore/GitFlow/BranchFinders/SupportVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SemanticVersion BuildVersion(IRepository repository, Commit tip, ShortVersion sh
4141
Major = shortVersion.Major,
4242
Minor = shortVersion.Minor,
4343
Patch = shortVersion.Patch,
44-
BuildMetaData = new SemanticVersionBuildMetaData(null, "support", releaseDate)
44+
BuildMetaData = new SemanticVersionBuildMetaData(null, "support", releaseDate, tip.Sha,tip.When())
4545
};
4646
}
4747
}

GitVersionCore/GitHubFlow/BuildNumberCalculator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public SemanticVersion GetBuildNumber(GitVersionContext context)
2626
var releaseDate = ReleaseDateFinder.Execute(context.Repository, context.CurrentCommit, semanticVersion.Patch);
2727

2828
// TODO Need a way of setting this in a cross cutting way
29-
semanticVersion.BuildMetaData = new SemanticVersionBuildMetaData(commitsSinceLastRelease,
30-
context.CurrentBranch.Name, releaseDate);
29+
semanticVersion.BuildMetaData = new SemanticVersionBuildMetaData(commitsSinceLastRelease, context.CurrentBranch.Name, releaseDate, context.CurrentCommit.Sha, context.CurrentCommit.When());
3130
if (context.CurrentBranch.IsPullRequest())
3231
{
3332
EnsurePullBranchShareACommonAncestorWithMaster(gitRepo, gitRepo.Head);

GitVersionCore/GitVersionCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<Compile Include="BuildServers\TeamCity.cs" />
6666
<Compile Include="CachedVersion.cs" />
6767
<Compile Include="DirectoryDateFinder.cs" />
68-
<Compile Include="ReleaseDateFinder - Copy.cs" />
68+
<Compile Include="LastVersionOnMasterFinder.cs" />
6969
<Compile Include="ShortVersion.cs" />
7070
<Compile Include="SemanticVersionExtensions.cs" />
7171
<Compile Include="WarningException.cs" />

0 commit comments

Comments
 (0)