Don't use a broken version string when git is not found

This commit is contained in:
abcdefg30
2017-05-26 10:31:30 +02:00
committed by reaperrr
parent 057c201e85
commit 841798a0a8

View File

@@ -60,6 +60,9 @@ function Version-Command
$version = $command[1]
}
elseif (Get-Command 'git' -ErrorAction SilentlyContinue)
{
$gitRepo = git rev-parse --is-inside-work-tree
if ($gitRepo)
{
$version = git name-rev --name-only --tags --no-undefined HEAD 2>$null
if ($version -eq $null)
@@ -68,6 +71,11 @@ function Version-Command
}
}
else
{
echo "Not a git repository. The version will remain unchanged."
}
}
else
{
echo "Unable to locate Git. The version will remain unchanged."
}