feat: native git module and themed gitmux background - #13
Merged
Merged
Conversation
Branch plus a minimal clean/dirty summary printed as plain text by utils/git_status.sh, so the block is styled natively by variant/accent and a dirty work tree warms the accent through the shared active machinery (@themux_git_active_when backed by a cheap tracked-only probe). Renders only inside a git work tree, like gitmux.
gitmux's default palette targets a black bar; defaulting the text block to @thm_crust keeps those colours readable on any theme surface.
Asserts the when gate, dirty escalation and script invocation wiring, the gitmux text background default, and runs git_status.sh against a throwaway repo through clean, staged, modified/untracked, --dirty probe, symbol override and non-repo states.
Adds the Git module entry (options, dirty escalation, when to prefer it over gitmux), notes gitmux's new text background default, registers git in the built-in module list, and fixes the stale per-module background override to the real @themux_<name>_text_bg option.
A raw per-channel _text_bg/_icon_bg override was applied unconditionally to both the resting and active channel, so gitmux's crust text background (the default since the previous commit) painted an opaque block even under the naked variant, which promises a transparent background. Gate each bg override by that channel's own resolved variant instead.
…d path The staged count rendered as "<n>A" while counting every X in [MTADRC], which reads as "added" but really means "staged" — relabel it "S". An unmerged XY pair (UU, AU, UA, DU, UD, DD, AA) was counted straight into the staged/modified/deleted groups instead of its own conflicts group, so a conflicted file rendered as an ordinary change; detect it first and count it as "<n>C" ahead of the rest. --dirty used status --porcelain -uno (tracked changes only) while the text mode counts untracked files too, so an untracked-only work tree showed "! 1?" in the text but kept the accent resting; drop -uno so both passes agree. Quote the script path in both #() invocations in git.conf so an install path containing spaces doesn't break the command.
Add a real UU conflict repo (two branches editing the same line, then a failed merge) asserting "<branch> ! 1C", then layer a fabricated add/add and delete/delete pair onto the same unresolved merge to assert AA/DD count as conflicts instead of leaking into the staged/deleted groups. Cover the untracked-only --dirty/text parity fix and the quoted script path invocations, and update the staged-label expectation to "S". Trap the temp repos right after mktemp so the harness ERR-trap path can't leak them.
The conflict fixtures built a UU via a real `git merge` and layered a
fabricated AA/DD on top of it. On CI (no git identity configured, unlike
this machine's global gitconfig) the un-`-c`'d merge aborted immediately
with "unable to auto-detect email address" before ever attempting the
merge, an error silently swallowed by `|| true`; the repo was left clean
("main ✓" instead of "main ! 1C"), and the AA+DD fabricated on top of that
unchanged state only produced 2 conflicts instead of 3. Both mismatches
were the same root cause, not two separate bugs.
Fabricate all three conflict types (UU, AA, DD) directly through index
stages instead — the same stage combination git itself uses to derive the
XY code (1+2+3 = UU, 2+3 with no 1 = AA, 1 alone = DD) — so the fixture no
longer depends on a real merge's identity requirement, diff outcome or
version-specific merge machinery. Each fabrication is verified against a
fresh `git status --porcelain` right away via a require_conflict() guard,
so a stanza that fails to register is an immediate, clearly labelled
failure instead of a silently wrong count downstream.
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.
Summary
Adds a native
gitstatus-line module and keeps gitmux fully supported with one readability fix:gitmodule (modules/git.conf+utils/git_status.sh): minimal output —main ✓clean,main ! 1C 1S 2M 1?dirty (conflicts, staged, modified, deleted, untracked; zero groups omitted; short SHA when detached). No inline colour codes: the text block is styled natively, so every themux prop (variant, accent, shape, notch, padding, cascade) applies. A dirty repo escalates the accent through the existing_active_whenmachinery (teal → peach by default). Rendered only inside a git work tree; no external dependency.@themux_gitmux_text_bg.naked: a per-slot bg override no longer paints an opaque block on a channel whose resolved variant isnaked(per-channel gating inmodule_render.sh).Changes
modules/git.confwhengate,_active_whendirty escalation, quoted script invocationutils/git_status.sh--porcelain -bXY-column parser (conflicts/staged/modified/deleted/untracked),--dirtymode, detached fallbackmodules/gitmux.conf#{E:@thm_crust}utils/module_render.shnakedthemux.conftests/git_module.sh(+expected)docs/reference/*.md@themux_module_<name>_bg_coloroption nameTest plan
tests/run_tests.sh— 16/16 (15 existing + newgit_module)shellcheck -aclean on all scripts