fix(hook): apply exclude_commands to head/tail rewrites by guyoron1 · Pull Request #2612 · rtk-ai/rtk · GitHub
Skip to content

fix(hook): apply exclude_commands to head/tail rewrites#2612

Open
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/head-tail-exclude-commands
Open

fix(hook): apply exclude_commands to head/tail rewrites#2612
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/head-tail-exclude-commands

Conversation

@guyoron1

@guyoron1 guyoron1 commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • The head/tail short-circuit in rewrite_segment_inner returned a rewrite before reaching the exclusion check, so hooks.exclude_commands entries for head/tail were silently ignored
  • Add the is_excluded() check before the rewrite_line_range() call, matching the pattern used by other commands in the same function

Fixes #2363

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Added unit tests: head excluded, tail excluded, cross-exclusion (excluding tail doesn't affect head)
  • Manual testing: add head to hooks.exclude_commands in config, verify head -20 file is no longer rewritten

The head/tail short-circuit in rewrite_segment_inner returned a
rewrite before reaching the exclusion check, so hooks.exclude_commands
entries for head/tail were silently ignored.
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.

hooks.exclude_commands does not apply to head/tail rewrites

1 participant