From 2c1cab350b0d8d27b1388a09a9d5e68136e36c24 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 13 Sep 2017 11:40:55 +0200 Subject: [PATCH] Fix off-by-one error in appveyor-install.ps1 and use branch name from APPVEYOR_REPO_BRANCH in case of AppVeyor build in UpdateAssemblyInfo. --- BuildTools/UpdateAssemblyInfo/Main.cs | 7 ++++++- BuildTools/appveyor-install.ps1 | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/BuildTools/UpdateAssemblyInfo/Main.cs b/BuildTools/UpdateAssemblyInfo/Main.cs index e1fe51dbd..7f1f312cc 100644 --- a/BuildTools/UpdateAssemblyInfo/Main.cs +++ b/BuildTools/UpdateAssemblyInfo/Main.cs @@ -197,7 +197,12 @@ namespace UpdateAssemblyInfo if (Directory.Exists(".git")) { try { ReadRevisionNumberFromGit(); - ReadBranchNameFromGit(); + string appVeyorBranch = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"); + // AppVeyor uses a repository with detached head. + if (string.IsNullOrWhiteSpace(appVeyorBranch)) + ReadBranchNameFromGit(); + else + gitBranchName = appVeyorBranch; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } diff --git a/BuildTools/appveyor-install.ps1 b/BuildTools/appveyor-install.ps1 index 69f181e17..29d64f198 100644 --- a/BuildTools/appveyor-install.ps1 +++ b/BuildTools/appveyor-install.ps1 @@ -9,7 +9,7 @@ if ($env:APPVEYOR_REPO_BRANCH -ne 'master') { $branch = ""; } -$build = git rev-list --count "$baseCommitHash..HEAD"; +$build = [Int32]::Parse((git rev-list --count "$baseCommitHash..HEAD")) + 1; $newVersion="$majorVersion.$minorVersion.$revision.$build"; $env:ilspy_version_number=$newVersion;