Skip to content

Commit

Permalink
Merge pull request #170 from stgolem/master
Browse files Browse the repository at this point in the history
Added ShortLength parameter to GitVersion task
  • Loading branch information
pwelter34 committed Jul 13, 2015
2 parents 05a6c57 + 9203cba commit 590ce0d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Source/MSBuild.Community.Tasks/Git/GitVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public GitVersion()
{
Command = "rev-parse";
Short = true;
ShortLength = 0;
Revision = "HEAD";
}

Expand All @@ -69,6 +70,14 @@ public GitVersion()
/// </value>
public bool Short { get; set; }

/// <summary>
/// Gets or sets a value indicating short hash length.
/// </summary>
/// <value>
/// Length for short hash.
/// </value>
public int ShortLength { get; set; }

/// <summary>
/// Generates the arguments.
/// </summary>
Expand All @@ -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);

Expand Down

0 comments on commit 590ce0d

Please sign in to comment.