Skip to content

Fix cache subcommand detection when cache directory exists - #3850

Open
zhangli091011 wants to merge 2 commits into
sharkdp:masterfrom
zhangli091011:fix-cache-directory-subcommand
Open

Fix cache subcommand detection when cache directory exists#3850
zhangli091011 wants to merge 2 commits into
sharkdp:masterfrom
zhangli091011:fix-cache-directory-subcommand

Conversation

@zhangli091011

Copy link
Copy Markdown

Summary

  • keep the hidden cache subcommand enabled when ./cache is a directory
  • continue treating a regular file named cache as input for cat compatibility
  • add a deterministic integration test that clears an artifact from a cache directory in the working directory

Fixes #1726.

PR #3743 previously proposed the same production fix but was closed unmerged by its author. This version uses a smaller, cross-platform regression test and follows the current changelog workflow.

Tests

  • cargo fmt --all -- --check
  • cargo test --test integration_tests cache_
  • cargo test --test integration_tests can_print_file_named_cache -- --exact
  • cargo check --all-targets --all-features
  • cargo clippy --all-targets --all-features -- -D warnings

AI Assistance

This change was implemented with AI assistance. The issue state, repository policies, code, diff, and test results were reviewed by the submitter before submission.

@zhangli091011

Copy link
Copy Markdown
Author

The failing cargo audit/all-jobs checks are unrelated to this change. This PR does not modify Cargo.toml or Cargo.lock; the checked-in base lockfile contains crossbeam-epoch 0.9.18 (RUSTSEC-2026-0204) and quick-xml 0.39.4 (RUSTSEC-2026-0194/0195). All functional, platform, MSRV, quality, license, documentation, and changelog checks pass. I have not mixed an unrelated dependency upgrade into this focused cache-subcommand fix; this should clear when the base lockfile is updated or the repository handles the audit result.

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.

Errors for bat cache --build when cache already exists and BAT_CACHE_PATH is specified

1 participant