From 7a6564ed8aa84e2bb6157a6a9b72310a056c2745 Mon Sep 17 00:00:00 2001 From: Cody Anderson Date: Sat, 11 Jul 2026 13:54:27 -0600 Subject: [PATCH] =?UTF-8?q?fix(#2163):=20review=20fixes=20=E2=80=94=20chan?= =?UTF-8?q?geset=20format,=20explicit=20maxBuffer,=20hoisted=20require?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - changeset reformatted to the bold-lead + (#2163) house convention - explicit 8 MiB maxBuffer on the git spawn (default 1 MiB could overflow on huge dirty repos; overflow still degrades to segment-absent) - child_process require hoisted to module level per file style Claude-Session: https://claude.ai/code/session_01Hme55Pvq6BhpgwBcyC5HAg --- .changeset/silly-moles-romp.md | 2 +- hooks/gsd-statusline.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.changeset/silly-moles-romp.md b/.changeset/silly-moles-romp.md index 7c242d190..b8f463969 100644 --- a/.changeset/silly-moles-romp.md +++ b/.changeset/silly-moles-romp.md @@ -2,4 +2,4 @@ type: Added pr: 2183 --- -Opt-in git branch and working-state segment in the statusline (`statusline.show_git`): branch name plus staged/unstaged/untracked/ahead/behind markers, or ✓ when clean and in sync, rendered after the directory segment. Default off; when disabled no git subprocess is spawned and output is unchanged. +**Opt-in git branch and working-state segment in the statusline** — the shell prompt's branch/dirty-state signal is hidden for the whole session under the Claude Code TUI, so wrong-branch commits and ship-time push rejections surface only after the fact. New `statusline.show_git` config (default `false`) renders the branch name plus staged/unstaged/untracked/ahead/behind markers (or ✓ when clean and in sync) after the directory segment. When disabled, no git subprocess is spawned and output is unchanged. (#2163) diff --git a/hooks/gsd-statusline.js b/hooks/gsd-statusline.js index c089bda34..6f718763a 100755 --- a/hooks/gsd-statusline.js +++ b/hooks/gsd-statusline.js @@ -6,6 +6,7 @@ const fs = require('fs'); const path = require('path'); const os = require('os'); +const { execFileSync } = require('child_process'); const { isSemverNewer } = require('../gsd-core/bin/lib/semver-compare.cjs'); const { PACKAGE_NAME, updateCacheFileName } = require('../gsd-core/bin/lib/package-identity.cjs'); @@ -335,9 +336,11 @@ const GIT_STATUS_TIMEOUT_MS = 1500; */ function readGitStatus(dir) { try { - const { execFileSync } = require('child_process'); + // 8 MiB maxBuffer (default 1 MiB) headroom for repos with very many changed + // or untracked files; overflow still degrades safely to segment-absent via + // the catch below. return execFileSync('git', ['-C', dir, 'status', '--porcelain=v2', '--branch'], - { encoding: 'utf8', timeout: GIT_STATUS_TIMEOUT_MS, stdio: ['ignore', 'pipe', 'ignore'] }); + { encoding: 'utf8', timeout: GIT_STATUS_TIMEOUT_MS, maxBuffer: 8 * 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore'] }); } catch (e) { return null; }