From 9203cbaeb81091a1830b12b93e75d9c39aeba028 Mon Sep 17 00:00:00 2001 From: kononov Date: Mon, 13 Jul 2015 15:39:27 +0400 Subject: [PATCH] Added ShortLength parameter to GitVersion task --- Source/MSBuild.Community.Tasks/Git/GitVersion.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/MSBuild.Community.Tasks/Git/GitVersion.cs b/Source/MSBuild.Community.Tasks/Git/GitVersion.cs index f88e012e..a3388bd6 100644 --- a/Source/MSBuild.Community.Tasks/Git/GitVersion.cs +++ b/Source/MSBuild.Community.Tasks/Git/GitVersion.cs @@ -47,6 +47,7 @@ public GitVersion() { Command = "rev-parse"; Short = true; + ShortLength = 0; Revision = "HEAD"; } @@ -69,6 +70,14 @@ public GitVersion() /// public bool Short { get; set; } + /// + /// Gets or sets a value indicating short hash length. + /// + /// + /// Length for short hash. + /// + public int ShortLength { get; set; } + /// /// Generates the arguments. /// @@ -78,7 +87,10 @@ protected override void GenerateArguments(CommandLineBuilder builder) builder.AppendSwitch("--verify"); if (Short) - builder.AppendSwitch("--short"); + { + if (ShortLength > 0) builder.AppendSwitch("--short=" + ShortLength); + else builder.AppendSwitch("--short"); + } base.GenerateArguments(builder);