[All OS] Output full version of git to software report (#5097)

This commit is contained in:
Maksim Shilov
2022-02-18 10:23:34 +03:00
committed by GitHub
parent 2269ded856
commit 4d4f454424
4 changed files with 16 additions and 6 deletions

View File

@@ -161,3 +161,15 @@ function Test-BlankElement {
exit 1
}
}
function Take-Part {
param (
[Parameter(ValueFromPipeline)]
[string] $toolOutput,
[string] $Delimiter = " ",
[int[]] $Part
)
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
$selectedParts = $parts[$Part]
return [string]::Join($Delimiter, $selectedParts)
}

View File

@@ -67,8 +67,7 @@ function Get-DockerWincredVersion {
}
function Get-GitVersion {
$(git version) -match "git version (?<version>\d+\.\d+\.\d+)" | Out-Null
$gitVersion = $Matches.Version
$gitVersion = git --version | Take-Part -Part -1
return "Git $gitVersion"
}