Don't use a broken version string when git is not found
This commit is contained in:
8
make.ps1
8
make.ps1
@@ -60,6 +60,9 @@ function Version-Command
|
|||||||
$version = $command[1]
|
$version = $command[1]
|
||||||
}
|
}
|
||||||
elseif (Get-Command 'git' -ErrorAction SilentlyContinue)
|
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
|
$version = git name-rev --name-only --tags --no-undefined HEAD 2>$null
|
||||||
if ($version -eq $null)
|
if ($version -eq $null)
|
||||||
@@ -68,6 +71,11 @@ function Version-Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
echo "Not a git repository. The version will remain unchanged."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
echo "Unable to locate Git. The version will remain unchanged."
|
echo "Unable to locate Git. The version will remain unchanged."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user