Skip to content

Commit 828012d

Browse files
committed
fix: suppress CRLF warnings in auto-commit.ps1 (github#2253)
Replace 2> with 2>&1 redirection and assignment to properly suppress stderr output including CRLF warnings on Windows. Exit code logic preserved for change detection. Fixes github#2253
1 parent 669e253 commit 828012d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎extensions/git/scripts/powershell/auto-commit.ps1‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ if (-not $enabled) {
117117
}
118118

119119
# Check if there are changes to commit
120-
$diffHead = git diff --quiet HEAD 2>$null; $d1 = $LASTEXITCODE
121-
$diffCached = git diff --cached --quiet 2>$null; $d2 = $LASTEXITCODE
122-
$untracked = git ls-files --others --exclude-standard 2>$null
120+
$null = git diff --quiet HEAD 2>&1
121+
$d1 = $LASTEXITCODE
122+
$null = git diff --cached --quiet 2>&1
123+
$d2 = $LASTEXITCODE
124+
$untracked = git ls-files --others --exclude-standard 2>&1
123125

124126
if ($d1 -eq 0 -and $d2 -eq 0 -and -not $untracked) {
125127
Write-Host "[specify] No changes to commit after $EventName" -ForegroundColor DarkGray

0 commit comments

Comments
 (0)