From 3553ab79e1ea5d3d0a8eb679a3e2c0c45e26f184 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Wed, 11 Feb 2026 00:44:35 +0900 Subject: [PATCH] fix(git-worktree): use trimEnd instead of trim to preserve leading whitespace Git status porcelain output uses leading spaces for status indicators; trim() was stripping them which could break parsing. --- src/shared/git-worktree/collect-git-diff-stats.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/git-worktree/collect-git-diff-stats.ts b/src/shared/git-worktree/collect-git-diff-stats.ts index b16d5eba..f4cb3433 100644 --- a/src/shared/git-worktree/collect-git-diff-stats.ts +++ b/src/shared/git-worktree/collect-git-diff-stats.ts @@ -12,21 +12,21 @@ export function collectGitDiffStats(directory: string): GitFileStat[] { encoding: "utf-8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"], - }).trim() + }).trimEnd() const statusOutput = execFileSync("git", ["status", "--porcelain"], { cwd: directory, encoding: "utf-8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"], - }).trim() + }).trimEnd() const untrackedOutput = execFileSync("git", ["ls-files", "--others", "--exclude-standard"], { cwd: directory, encoding: "utf-8", timeout: 5000, stdio: ["pipe", "pipe", "pipe"], - }).trim() + }).trimEnd() const untrackedNumstat = untrackedOutput ? untrackedOutput