dotnet/core-setup-4510-commit-id.patch
2023-02-27 12:42:05 -05:00

49 lines
1.9 KiB
Diff

From e02ee86364b9db3edc298a6a081004aa07473d09 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Wed, 29 Aug 2018 17:03:25 -0400
Subject: [PATCH] Allow setting the commit id using /p:LatestCommit
This is similar to how CommitCount is already supported.
This lets consumers who are building outside a git repo, such as
source-build, set a commit id which is displayed by `dotnet --info`
and `strings dotnet | grep '@(#)'`.
See: https://github.com/dotnet/source-build/issues/651
See: https://github.com/dotnet/cli/pull/5945
---
dir.targets | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dir.targets b/dir.targets
index 8d34872c6..59dc1ebde 100644
--- a/dir.targets
+++ b/dir.targets
@@ -17,7 +17,8 @@
<Exec Command="$(DotnetToolCommand) build $(MSBuildThisFileDirectory)tools-local/tasks/core-setup.tasks.csproj" />
</Target>
- <Target Name="GetLatestCommitHash">
+ <Target Name="GetLatestCommitHash"
+ Condition="'$(LatestCommit)' == ''">
<!-- Get the latest commit hash -->
<Exec Command="git rev-parse HEAD 2>&amp;1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" />
@@ -29,13 +30,13 @@
</PropertyGroup>
</Target>
- <Target Name="GetCommitCount">
+ <Target Name="GetCommitCount"
+ Condition="'$(CommitCount)' == ''">
<Exec Command="git rev-list --count HEAD"
StandardOutputImportance="Low"
IgnoreExitCode="true"
IgnoreStandardErrorWarningFormat="true"
- ConsoleToMSBuild="true"
- Condition="'$(CommitCount)' == ''">
+ ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="CommitCount" />
<Output TaskParameter="ExitCode" PropertyName="CommitCountExitCode" />
</Exec>