Skip to content

Silence git stderr in non-repository folders (fixes 'fatal: not a git repository' noise) - #2

Open
D3mianGianoz wants to merge 1 commit into
pifydev:mainfrom
D3mianGianoz:suppress-git-stderr-in-non-repo
Open

D3mianGianoz wants to merge 1 commit into
pifydev:mainfrom
D3mianGianoz:suppress-git-stderr-in-non-repo

Conversation

@D3mianGianoz

Copy link
Copy Markdown

When working in a folder that is not a git repository, yolo prints git fatal messages on every risky bash/powershell command and on /yolo rewind:

fatal: not a git repository (or any of the parent directories): .git

The extension already handles these failures internally (gitHead returns null, decideCheckpoint returns {failed:true}), but execFileSync("git", ...) uses the default stdio, so git's stderr leaks to the terminal. It is noise, not a functional issue — commands still behave per mode and the trail still logs.

Fix: pass stdio: ["ignore", "pipe", "ignore"] to the 5 execFileSync("git", ...) calls in extensions/yolo.ts (gitHead, gitCheckpoint runGit/update-ref, releaseRefs, /yolo rewind restore). Stdout keeps working; only stderr is silenced.

Related issue: #1

When the working folder is not a git repository, git calls (rev-parse, stash create, update-ref) printed 'fatal: not a git repository' to the terminal on every risky command and on /yolo rewind. The errors are already caught internally, but their stderr leaked through. Pass stdio: ["ignore", "pipe", "ignore"] to the 5 execFileSync("git", ...) calls. Behavior in repos is unchanged; in non-repos the git ops fail silently instead of printing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant