Ignore error output from git diff in code check (#7923)

This commit is contained in:
Pavel Krymets 2019-02-25 12:55:54 -08:00 committed by GitHub
parent 9e21faeafb
commit 3b95ef0b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -133,14 +133,10 @@ try {
Write-Host "Run git diff to check for pending changes"
# Redirect stderr to stdout because PowerShell does not consistently handle output to stderr
$changedFiles = & cmd /c 'git --no-pager diff --ignore-space-at-eol --name-only 2>&1'
$changedFiles = & cmd /c 'git --no-pager diff --ignore-space-at-eol --name-only 2>nul'
if ($changedFiles) {
foreach ($file in $changedFiles) {
if (($file -like 'warning:*') -or ($file -like 'The file will have its original line endings*')) {
# git might emit warnings to stderr about CRLF vs LR, which can vary from machine to machine based on git's configuration
continue
}
$filePath = Resolve-Path "${repoRoot}/${file}"
LogError "Generated code is not up to date in $file." -filepath $filePath
& git --no-pager diff --ignore-space-at-eol $filePath