The value of the MSBuild property $(GitCommitDateTicks) comes from the Git author date, even though the name and API documentation indicate that it should come from the Git commit date. The commit date would be more useful in our workflow in which we often cherry-pick commits that are several months old. If the commit date is old, then it is easy to know for sure that the deployed version cannot include any changes that were implemented after that date. The author date cannot be used for this purpose.
Reproduced with Nerdbank.GitVersioning 3.4.240, but the code looks like it works like that in v3.5.113 too:
|
public override DateTimeOffset? GitCommitDate => this.Commit?.Author.When; |
|
public override DateTimeOffset? GitCommitDate => this.Commit is { } commit ? (commit.Author?.Date ?? this.Repository.GetCommit(commit.Sha, readAuthor: true).Author?.Date) : null; |
|
Assert.Equal(this.LibGit2Repository.Head.Tip.Author.When, this.Context.GitCommitDate); |
The value of the MSBuild property
$(GitCommitDateTicks)comes from the Git author date, even though the name and API documentation indicate that it should come from the Git commit date. The commit date would be more useful in our workflow in which we often cherry-pick commits that are several months old. If the commit date is old, then it is easy to know for sure that the deployed version cannot include any changes that were implemented after that date. The author date cannot be used for this purpose.Reproduced with Nerdbank.GitVersioning 3.4.240, but the code looks like it works like that in v3.5.113 too:
Nerdbank.GitVersioning/src/NerdBank.GitVersioning/LibGit2/LibGit2Context.cs
Line 50 in a908c6d
Nerdbank.GitVersioning/src/NerdBank.GitVersioning/Managed/ManagedGitContext.cs
Line 53 in a908c6d
Nerdbank.GitVersioning/src/NerdBank.GitVersioning.Tests/GitContextTests.cs
Line 43 in a908c6d