Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit 590ce0d

Browse files
committed
Merge pull request #170 from stgolem/master
Added ShortLength parameter to GitVersion task
2 parents 05a6c57 + 9203cba commit 590ce0d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Source/MSBuild.Community.Tasks/Git/GitVersion.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public GitVersion()
4747
{
4848
Command = "rev-parse";
4949
Short = true;
50+
ShortLength = 0;
5051
Revision = "HEAD";
5152
}
5253

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

73+
/// <summary>
74+
/// Gets or sets a value indicating short hash length.
75+
/// </summary>
76+
/// <value>
77+
/// Length for short hash.
78+
/// </value>
79+
public int ShortLength { get; set; }
80+
7281
/// <summary>
7382
/// Generates the arguments.
7483
/// </summary>
@@ -78,7 +87,10 @@ protected override void GenerateArguments(CommandLineBuilder builder)
7887
builder.AppendSwitch("--verify");
7988

8089
if (Short)
81-
builder.AppendSwitch("--short");
90+
{
91+
if (ShortLength > 0) builder.AppendSwitch("--short=" + ShortLength);
92+
else builder.AppendSwitch("--short");
93+
}
8294

8395
base.GenerateArguments(builder);
8496

0 commit comments

Comments
 (0)