Skip to content

fix(rewrite): never rewrite yadm to rtk git; keep bare git add a no-op - #3414

Open
RawNuke wants to merge 2 commits into
rtk-ai:developfrom
RawNuke:fix/yadm-rewrite-bare-git-add
Open

RawNuke wants to merge 2 commits into
rtk-ai:developfrom
RawNuke:fix/yadm-rewrite-bare-git-add

Conversation

@RawNuke

@RawNuke RawNuke commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #3408

Two rewrite-layer defects that combine into a data-integrity problem.

1. yadm is rewritten to git

The git rule in src/discover/rules.rs enumerated yadm in its pattern and rewrite_prefixes, so rtk rewrite yadm status produced rtk git status. rtk git executes the literal git binary in the current working directory. Since yadm manages a separate dotfiles repository whose work-tree is $HOME, yadm commit, yadm push, yadm checkout, and yadm add silently redirected to the project repo the shell was standing in.

yadm list already routed correctly to rtk yadm list because the yadm filter (src/filters/yadm.toml) handled it; the git rule shadowed that filter for exactly the subcommands it enumerated.

Fix: remove yadm from the rule's pattern and rewrite_prefixes. All yadm subcommands now route through the yadm filter to rtk yadm <subcommand>, which executes the yadm binary against the dotfiles repo.

$ rtk rewrite yadm status   →  rtk yadm status
$ rtk rewrite yadm commit -m x → rtk yadm commit -m x
$ rtk rewrite yadm add .    →  rtk yadm add .

2. Bare git add gained a .

src/cmds/git/git.rs injected "." when git add had no pathspec. Real git add with no pathspec is a deliberate no-op ("Nothing specified, nothing added."). Through rtk it staged the entire working tree, including files the user had not tracked.

Reproduced at v0.44.2 (700bdde):

$ git add                      # real git
Nothing specified, nothing added.
$ git diff --cached --name-only
                               # (nothing staged)

$ rtk git add
$ git diff --cached --name-only
.env
tracked.txt

Fix: a bare rtk git add passes no pathspec, so nothing gets staged implicitly. Verified after the fix: rtk git add stages nothing.

Tests

  • discover::registry::tests::test_classify_yadm_status, test_classify_yadm_diff — yadm is no longer classified as rtk git.
  • test_rewrite_yadm_status, test_rewrite_yadm_commit, test_rewrite_yadm_add — regression tests for the rewrite path.
  • cmds::git::git::tests::test_add_with_no_args_gets_no_pathspec, test_add_with_args_passes_them_through — regression tests for the add pathspec behavior.

cargo test (2566 + integration suites) passes; cargo clippy --all-targets is clean.

yadm manages a separate dotfiles repository whose work-tree is HOME.
The git rewrite rule enumerated yadm in its pattern and rewrite
prefixes, so yadm commit/push/checkout/add were rewritten to 'rtk git'
and acted on whatever project the shell was standing in. Remove yadm
from the rule; the yadm filter now routes yadm to the yadm binary as
'rtk yadm <subcommand>', matching the already-correct 'yadm list' path.

run_add also injected '.' when git add had no pathspec, turning real
git's deliberate no-op into a whole-worktree stage. A bare 'rtk git add'
now passes no pathspec, so nothing gets staged implicitly.

Closes rtk-ai#3408
@CLAassistant

CLAassistant commented Aug 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants