Skip to content

Build cache automatically on first run when custom sources exist - #4038

Merged
keith-hall merged 3 commits into
sharkdp:masterfrom
mmustafasenoglu:fix/cache-auto-build-4017
Nov 2, 2026
Merged

keith-hall merged 3 commits into
sharkdp:masterfrom
mmustafasenoglu:fix/cache-auto-build-4017

Conversation

@mmustafasenoglu

Copy link
Copy Markdown
Contributor

Custom themes or syntaxes added to the config directory are silently ignored until bat cache --build is run manually, which is confusing on a fresh setup (e.g. after installing dotfiles on a new machine).

Changes:

  • If themes/ or syntaxes/ in the config directory contain files but no cache exists yet, the cache is built automatically on first run, with a short notice on stderr.
  • A failed automatic build only warns and falls back to the integrated assets instead of failing.
  • --no-custom-assets opts out of the automatic build.

Tests:

  • Added cache_auto_build_on_first_run and cache_no_auto_build_with_no_custom_assets integration tests.
  • cargo fmt --check, cargo clippy --all-targets --all-features (warnings denied), and the `cache_*!/theme/language integration tests pass. Also verified manually that a custom theme becomes usable right after the first run.

Fixes #4017.

Custom themes and syntaxes dropped into the config directory were
silently ignored until 'bat cache --build' was run manually. Now bat
builds the cache on first run when sources are present but no cache
exists yet. A failed build only warns and falls back to the integrated
assets; --no-custom-assets opts out.

Fixes #4017
Copilot AI balanced review requested due to automatic review settings October 2, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@keith-hall
keith-hall merged commit cb6bb8e into sharkdp:master Nov 2, 2026
24 checks passed
cindykrafft pushed a commit to cindykrafft/bat that referenced this pull request Nov 2, 2026
Brings in sharkdp#4038, sharkdp#4048 and sharkdp#4070. The merge of sharkdp#4048 re-added the old
UTF-16BE CHANGELOG entry with its "#XXXX" placeholder at the top of
Bugfixes, so drop that duplicate; the entry this PR corrects to sharkdp#4076
stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVn4SeAXPsUajXT2rtHQfo
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.

Build cache on first run of bat

3 participants