Repository navigation
feat(prompt): built-in Git Bash compatible factory default on Windows - #292
Merged
Merged
Conversation
… (owner adjudication 2026-10-12) The factory default prompt on Windows is now the Git Bash skeleton: green user@host, yellow POSIX-persona cwd, cyan branch (+ dirty *) and `$ ` — the MINGW64 environment segment is deliberately omitted (that is MinGW identity) and there is no static product tag (single-environment shells have no disambiguation need; identity lives in the banner). The branch/dirty segment reads the repository through git2 (owner-approved library dependency, adjudication option d; Windows-target-only compile) instead of a git child process — the prompt path never spawns (niubash#145 red line). Measured on this machine against a real repository: cold 39ms, warm p50 2.5ms / p90 3.7ms per prompt, versus Git Bash's per-prompt __git_ps1 fork (~100-300ms). Claims still win: a PS1/theme claim displaces the floor per prompt (prompt_slot_claimed check in prompt_for_display), set -o vi keeps the live editing-mode indicator (niubash#184 surface), and the theme does not exist off-Windows — a config naming it there falls back to the template floor, keeping the unix cfg-strip clean (#570 precedent). Tests: git_prompt unit matrix (branch/dirty/detached/tilde/persona/ budget), real-ConPTY factory-prompt scenario incl. cd into a repo, and the vi floor indicator updated to the new factory prompt char.
The unix acceptance lanes caught it: the module declaration had no cfg gate, so unix targets compiled src/git_prompt.rs against the Windows-only git2 dependency (E0433). Same #570 discipline as the rest of the theme.
…false positive
"echo two".contains("cho two") is true by substring semantics (the
editor echo of the input line contains it), so the probe failed on
healthy shells too. Execution-level verification (flush trace, submit
buffer, arithmetic-mark outputs) shows the paste bytes intact on
current master; the real paste defects are #308 (fixed by #309) and
the owner-machine investigation tracked in #291.
The unix -D warnings lanes flag gitbash_prompt_active as never-read (the refresh site is cfg'd out there); cfg_attr keeps the field for the Windows state machine while silencing the unix dead-code leg.
…d the #317 execution-level paste regressions
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
…1.4.0 section (#326) - The [Unreleased] entries (#284/#287, #293-#304, #313) move into [1.4.0]; [Unreleased] is empty again. - Newly recorded (today's wave): Git Bash compatible factory default prompt (#292, headline), WT-form shortcuts (#290/#211), the paste burst trailing-Enter fix (#308/#291), self-update SHA256 + release pinning (#311/#312), managed-block convergence (#324), completion tables/NIU_COMPDEFS/NIU_ENV probe (#305-#307), -s on-demand stdin (rubash#586 host half), bash/rbash invocation faces (#321/#322). - Older gaps recorded: closed-stdout pipe contract (#245/#286), history session-end write-back (#265), sh POSIX contract (#262), PWD persona alignment (#283), one-shot fast path (#270), --cwd-state (#272), --encoded-command (#271), REPL-command highlighting (#281), docs passes (#255/#225/#226/#227), MSRV (#267), easter-egg prune (#264). CHANGELOG-only change; no version claims.
This was referenced Oct 13, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 14, 2026
…erer into the segments engine (closes #331) (#332) The oh-my-niu bundle's prompts/segments.toml declares [segments.git] id = vcs; the segments engine had no Vcs variant — a socket with no power. This lands the native segment for 1.4.1: - SegmentId::Vcs; from_name accepts vcs (the native id) and git (the bundle segment name), case/separator-insensitive as before. - Rendering goes through #292's in-process git2 renderer: git_prompt::branch_segment is now pub. branch / branch* / short-SHA detached, empty outside a repository. Zero child processes on the prompt path (niubash#145 red line; #604 measured PS1-embedded $(...) at ~100x native cost). Off-Windows the segment renders empty, matching the gitbash style's template fallback there. - Colour contract from the oh-my-niu themes: [git_clean] cyan, [git_dirty] yellow, keyed off the renderer's dirty star, applied regardless of preset (detached SHA renders clean-cyan, #292 style). - Perf: segment render p50 <= 10ms asserted (21-sample median, 10x headroom); measured warm p50 2.38ms / p90 2.47ms on the dev box, consistent with #292's 2.5ms. - Contract tests pin a verbatim mirror of the bundle's prompts/segments.toml: every declared id resolves natively and every shipped preset element resolves through the name->id map (the lean preset's git lands on SegmentId::Vcs).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner adjudication 2026-10-12 (structure, colors, red lines) + 2026-10-13 (git2 library dependency, option d). The previous attempt at this branch died at the rate limit with zero commits — rebuilt from the adjudication record.
The factory default prompt on Windows is now the Git Bash skeleton users already know:
niu --version.default-features = false— no network stack). Latency on a real repository: cold 39ms, warm p50 2.5ms / p90 3.7ms, vs Git Bash's per-prompt__git_ps1fork (~100-300ms) — the smoother-than-them deliverable, measured.*like__git_ps1. Detached HEAD shows the short SHA. Outside a repository the segment is empty.set -o vikeeps the live editing-mode indicator (niubash#184 surface — the indicator strings follow the new factory prompt char).Tests: git_prompt unit matrix (branch/dirty/detached/~ abbreviation/drive persona/120ms budget) 8/8; real-ConPTY factory-prompt scenario incl.
cdinto a repository; vi floor indicator updated to the factory char; runtime lib 473 green; interactive 43/44 (the 1 is the pre-existingctrl_d_after_background_job_exitsbaseline, red on clean master too).Follow-up (not in this PR): the setup wizard's theme question should describe the Skip option as "Git Bash compatible (built-in default)" on Windows.