Skip to content
Permalink
Browse files

Fix update-assemblyinfo.ps1 for worktrees

  • Loading branch information
siegfriedpammer committed Nov 16, 2019
1 parent 84bb61c commit 2be6d279b366a3619dc75d07b0718535178fb1c4
Showing with 9 additions and 5 deletions.
  1. +9 −5 BuildTools/update-assemblyinfo.ps1
@@ -9,11 +9,11 @@ $masterBranches = @("master", "5.0.x");
$globalAssemblyInfoTemplateFile = "ILSpy/Properties/AssemblyInfo.template.cs";

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) {
return [System.IO.Directory]::Exists( (Join-Path (Get-Location) $name) );
return [System.IO.Directory]::Exists((Join-Path (Get-Location) $name));
}

function Find-Git() {
@@ -38,22 +38,26 @@ function Find-Git() {
return $false;
}

function No-Git() {
return -not (((Test-Dir ".git") -or (Test-File ".git")) -and (Find-Git));
}

function gitVersion() {
if (-not ((Test-Dir ".git") -and (Find-Git))) {
if (No-Git) {
return 0;
}
return [Int32]::Parse((git rev-list --count "$baseCommit..HEAD")) + $baseCommitRev;
}

function gitCommitHash() {
if (-not ((Test-Dir ".git") -and (Find-Git))) {
if (No-Git) {
return "0000000000000000000000000000000000000000";
}
return (git rev-list "$baseCommit..HEAD") | Select -First 1;
}

function gitBranch() {
if (-not ((Test-Dir ".git" -or Test-File ".git") -and (Find-Git))) {
if (No-Git) {
return "no-branch";
}

0 comments on commit 2be6d27

Please sign in to comment.
You can’t perform that action at this time.