Skip to content

fix(hook): hook warning repeats on every command on Windows#742

Open
aimardcr wants to merge 1 commit intortk-ai:masterfrom
aimardcr:fix/hook-suppress-repeated-warning-on-windows
Open

fix(hook): hook warning repeats on every command on Windows#742
aimardcr wants to merge 1 commit intortk-ai:masterfrom
aimardcr:fix/hook-suppress-repeated-warning-on-windows

Conversation

@aimardcr
Copy link

Summary

  • std::fs::write(path, b"") writing 0 bytes to an already-empty marker file does not update the mtime on Windows
  • The rate-limiting check uses meta.modified() so the marker always looked stale, causing the "No hook installed" warning to fire on every invocation instead of once per day
  • Write a non-empty payload (b"1") so Windows always updates the mtime

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 982 tests pass
  • Manual testing: rtk output inspected
    • Set marker mtime to 5 days ago → rtk git status — warning shown (expected, marker expired)
    • rtk git status again — warning suppressed (rate-limiting works)
    • rtk tree — warning suppressed (persists across commands)

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

On Windows, `std::fs::write(path, b"")` writing 0 bytes to an
already-empty marker file does not update the mtime. The rate-limiting
check uses `meta.modified()` so the marker always looked stale,
causing the "No hook installed" warning to fire on every invocation
instead of once per day.

Write a non-empty payload (`b"1"`) so Windows always updates the mtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: aimardcr <aimaradhitya@gmail.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants