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);