Skip to content

Commit

Permalink
Merge pull request #1 from loresoft/master
Browse files Browse the repository at this point in the history
sync with base
  • Loading branch information
vpfau committed Dec 8, 2015
2 parents bf7fc57 + 7ef0c70 commit 83c3c8f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
22 changes: 11 additions & 11 deletions Source/MSBuild.Community.Tasks/FxCop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ public ITaskItem[] Rules
{
get { return _rules; }
set { _rules = value; }
}

/// <summary>
/// Gets or sets the rule set.
/// </summary>
/// <value>
/// The rule set.
/// </value>
}

/// <summary>
/// Gets or sets the rule set.
/// </summary>
/// <value>
/// The rule set.
/// </value>
public string RuleSet { get; set; }

private string _analysisReportFileName;
Expand Down Expand Up @@ -492,9 +492,9 @@ protected override string GenerateCommandLineCommands()
}
}

if (!string.IsNullOrEmpty(RuleSet))
{
_programArguments.AppendFormat("/ruleset:{0} ", RuleSet);
if (!string.IsNullOrEmpty(RuleSet))
{
_programArguments.AppendFormat("/ruleset:{0} ", RuleSet);
}

if (IncludeSummaryReport)
Expand Down
32 changes: 30 additions & 2 deletions Source/MSBuild.Community.Tasks/Git/GitDescribe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,22 @@ public GitDescribe()
/// </summary>
public string Match { get; set; }

/// <summary>
/// When true, Git describe will always return at least hash
/// </summary>
public bool Always { get; set; }

/// <summary>
/// Make sure we specify abbrev=40 to get full CommitHash
/// </summary>
/// <param name="builder"></param>
protected override void GenerateArguments(CommandLineBuilder builder)
{
builder.AppendSwitch("--long --abbrev=40");

if (Always)
builder.AppendSwitch("--always");

if (LightWeight)
builder.AppendSwitch("--tags");
if (!String.IsNullOrEmpty(Match))
Expand Down Expand Up @@ -124,8 +133,17 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport
// TODO: get rid of these "soft" errors once unit tests are in place
try
{
// We do +1 to skip the git-describe 'g' delimiter
CommitHash = line.Substring(hashPosition + 1);
if (hashPosition == -1) {

// In case there are no tags, git describe output will contain only hash
// (without 'g' delimiter)
CommitHash = line.Substring(0);
}
else
{
// We do +1 to skip the git-describe 'g' delimiter
CommitHash = line.Substring(hashPosition + 1);
}
}
catch
{
Expand All @@ -136,6 +154,16 @@ protected override void LogEventsFromTextOutput(string singleLine, MessageImport
return;
}

if (hashPosition == -1)
{
// hashPosition is -1, meaning there is no dash in git describe output
// Set Tag to blank and CommitCount to 0 and then return
Tag = "";
CommitCount = 0;

return;
}

int i;
// move backwards through git describe, now we've got our hash we move backwards
// skipping one dash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Git.GitCommits" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Git.GitCommitDate" />

<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.InnoSetup" />

<ItemGroup>
<FxCopRuleAssemblies Include="UsageRules.dll"/>
<FxCopRuleAssemblies Include="SecurityRules.dll"/>
Expand Down

0 comments on commit 83c3c8f

Please sign in to comment.