From 66d3de5142943305461b7522cead3a38eb0b966b Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 25 Apr 2018 09:48:14 -0700 Subject: [PATCH] Fix Hub location --- scripts/UpdateDependenciesCoreFx.ps1 | 1 + scripts/common.psm1 | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/UpdateDependenciesCoreFx.ps1 b/scripts/UpdateDependenciesCoreFx.ps1 index 2e92c4c4b5..2d35ce92fe 100644 --- a/scripts/UpdateDependenciesCoreFx.ps1 +++ b/scripts/UpdateDependenciesCoreFx.ps1 @@ -109,6 +109,7 @@ Write-Host "Loading deps from $depsPath" if (-not $NoCommit) { $baseBranch = "dev" + Invoke-Block { & git fetch origin } $currentBranch = Invoke-Block { & git rev-parse --abbrev-ref HEAD } $destinationBranch = "rybrande/UpgradeDepsTest" diff --git a/scripts/common.psm1 b/scripts/common.psm1 index 2911495571..e99d9a0881 100644 --- a/scripts/common.psm1 +++ b/scripts/common.psm1 @@ -15,7 +15,10 @@ function Invoke-Block([scriptblock]$cmd) { # - $?: did the powershell script block throw an error # - $lastexitcode: did a windows command executed by the script block end in error if ((-not $?) -or ($lastexitcode -ne 0)) { - Write-Warning $error[0] + if(($error -ne $null)) + { + Write-Warning $error[0] + } throw "Command failed to execute: $cmd" } } @@ -121,9 +124,8 @@ function Ensure-Hub() { if (-Not (Test-Path $hubLocation) ) { $source = "https://github.com/github/hub/releases/download/v2.3.0-pre9/hub-windows-amd64-2.3.0-pre9.zip" $zipLocation = "$tmpDir\hub.zip" - if(-not (Test-Path $zipLocation)) { - New-Item -ItemType directory -Path $tmpDir - } + + mkdir -Path $tmpDir -ErrorAction Ignore | Out-Null Invoke-WebRequest -OutFile $zipLocation -Uri $source @@ -169,8 +171,7 @@ function CommitUpdatedVersions( $subject = "Updating external dependencies" - # Have to pipe null so that the output from this doesn't end up as part of the return value - $null = Invoke-Block { & git commit -m $subject } + Invoke-Block { & git commit -m $subject } | Out-Null $body = "$subject`n`n"