You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standalone TOML filter — src/filters/yadm.toml reimplements a subset of git's filtering (strip blank/hint lines, truncate, max_lines). Filtered, but only partial parity with the Rust git filter.
A third class — chezmoi's chezmoi git <subcmd> — has the same working-directory-wrapper shape as yadm and is currently unfiltered. See #2117 for the chezmoi-specific scope.
The duplication
src/filters/yadm.toml re-creates a fraction of what src/cmds/git/git.rs already does. PR #436's chezmoi handler reimplements git diff parsing for chezmoi diff. Each wrapper carries its own divergent copy of git output logic, and the more wrappers RTK adopts the more this drift compounds.
Possible directions
Two shapes that came to mind, neither necessarily right:
A. TOML filter pipeline inheritance. Extend the TOML schema with an inherit_pipeline_from = "git" (or similar) field that runs the input through an existing Rust filter pipeline before the TOML line-based stages. Lets yadm.toml and a future chezmoi-git.toml share git's parsing while keeping wrapper-specific tweaks.
B. Command-level wrapper config. A [wrappers] section in config.toml, e.g.
[wrappers.chezmoi-git]
match = "^chezmoi git\\s+(.*)"inner_cmd = "git"filter_as = "rtk git"# apply git's output filter; do not rewrite the command
The runtime would still run chezmoi git status as-is, capture stdout, and route it through git's output filter. No command rewriting — avoids the #2077 trap.
Both shapes preserve working-directory semantics, which the existing rewrite_prefixes mechanism doesn't (per #2077, #2078).
Constraints
Wrappers set cwd implicitly (yadm via env, chezmoi via source-path). The wrapped git filter must operate on captured output, not re-invoke rtk git in $PWD.
rewrite_prefixes handles env-style wrappers (poetry run cargo) but is the wrong tool for wd-changing wrappers.
Motivation
yadm output filtering, currently limited to what TOML can express
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Context
RTK currently has two shapes for git wrappers:
rewrite_prefixes— yadm was added this way (feat(discover): treat yadm commands like git #940), then broken (yadm incorrectly rewritten to rtk git (yadm is not a git alias) #2077) and is being removed (fix: remove yadm from git rewrite rules #2078) because yadm uses--work-tree=$HOMEplus a bare repo, sortk git statusruns in the wrong cwd.src/filters/yadm.tomlreimplements a subset of git's filtering (strip blank/hint lines, truncate, max_lines). Filtered, but only partial parity with the Rust git filter.A third class — chezmoi's
chezmoi git <subcmd>— has the same working-directory-wrapper shape as yadm and is currently unfiltered. See #2117 for the chezmoi-specific scope.The duplication
src/filters/yadm.tomlre-creates a fraction of whatsrc/cmds/git/git.rsalready does. PR #436's chezmoi handler reimplementsgit diffparsing forchezmoi diff. Each wrapper carries its own divergent copy of git output logic, and the more wrappers RTK adopts the more this drift compounds.Possible directions
Two shapes that came to mind, neither necessarily right:
A. TOML filter pipeline inheritance. Extend the TOML schema with an
inherit_pipeline_from = "git"(or similar) field that runs the input through an existing Rust filter pipeline before the TOML line-based stages. Letsyadm.tomland a futurechezmoi-git.tomlshare git's parsing while keeping wrapper-specific tweaks.B. Command-level wrapper config. A
[wrappers]section inconfig.toml, e.g.The runtime would still run
chezmoi git statusas-is, capture stdout, and route it through git's output filter. No command rewriting — avoids the #2077 trap.Both shapes preserve working-directory semantics, which the existing
rewrite_prefixesmechanism doesn't (per #2077, #2078).Constraints
rtk gitin$PWD.rewrite_prefixeshandles env-style wrappers (poetry run cargo) but is the wrong tool for wd-changing wrappers.Motivation
chezmoi git, completely unfiltered today (~145 hits in one user's session — see feat: chezmoi dotfile manager support — and the chezmoi git gap #2117)mr run -j1 git(myrepos), other dotfile/multirepo helpersOpen questions
config.toml, or both with priority?CONTRIBUTING.md suggests discussing core changes before filing them as PRs, so opening this as an RFC rather than an issue.
Related
rtk git, breaks on bare-repo cwdrewrite_prefixesgit diffparsing)chezmoi gitgapEnvironment
Beta Was this translation helpful? Give feedback.
All reactions