Don't use a broken version string when git is not found
This commit is contained in:
14
make.ps1
14
make.ps1
@@ -61,10 +61,18 @@ function Version-Command
|
|||||||
}
|
}
|
||||||
elseif (Get-Command 'git' -ErrorAction SilentlyContinue)
|
elseif (Get-Command 'git' -ErrorAction SilentlyContinue)
|
||||||
{
|
{
|
||||||
$version = git name-rev --name-only --tags --no-undefined HEAD 2>$null
|
$gitRepo = git rev-parse --is-inside-work-tree
|
||||||
if ($version -eq $null)
|
if ($gitRepo)
|
||||||
{
|
{
|
||||||
$version = "git-" + (git rev-parse --short HEAD)
|
$version = git name-rev --name-only --tags --no-undefined HEAD 2>$null
|
||||||
|
if ($version -eq $null)
|
||||||
|
{
|
||||||
|
$version = "git-" + (git rev-parse --short HEAD)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "Not a git repository. The version will remain unchanged."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user