Browse Source

Fix update-assemblyinfo.ps1 for worktrees

pull/1801/head
Siegfried Pammer 6 years ago
parent
commit
2be6d279b3
  1. 14
      BuildTools/update-assemblyinfo.ps1

14
BuildTools/update-assemblyinfo.ps1

@ -9,11 +9,11 @@ $masterBranches = @("master", "5.0.x");
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs"; $globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs";
function Test-File([string]$filename) { function Test-File([string]$filename) {
return [System.IO.File]::Exists( (Join-Path (Get-Location) $filename) ); return [System.IO.File]::Exists((Join-Path (Get-Location) $filename));
} }
function Test-Dir([string]$name) { function Test-Dir([string]$name) {
return [System.IO.Directory]::Exists( (Join-Path (Get-Location) $name) ); return [System.IO.Directory]::Exists((Join-Path (Get-Location) $name));
} }
function Find-Git() { function Find-Git() {
@ -38,22 +38,26 @@ function Find-Git() {
return $false; return $false;
} }
function No-Git() {
return -not (((Test-Dir ".git") -or (Test-File ".git")) -and (Find-Git));
}
function gitVersion() { function gitVersion() {
if (-not ((Test-Dir ".git") -and (Find-Git))) { if (No-Git) {
return 0; return 0;
} }
return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev; return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev;
} }
function gitCommitHash() { function gitCommitHash() {
if (-not ((Test-Dir ".git") -and (Find-Git))) { if (No-Git) {
return "0000000000000000000000000000000000000000"; return "0000000000000000000000000000000000000000";
} }
return (git rev-list "$baseCommit..HEAD") | Select -First 1; return (git rev-list "$baseCommit..HEAD") | Select -First 1;
} }
function gitBranch() { function gitBranch() {
if (-not ((Test-Dir ".git" -or Test-File ".git") -and (Find-Git))) { if (No-Git) {
return "no-branch"; return "no-branch";
} }

Loading…
Cancel
Save