From 9438a74e6d01b7b2400caa6353d7e0048d3a47a9 Mon Sep 17 00:00:00 2001 From: yuwk <1729065730@qq.com> Date: Fri, 16 Oct 2026 02:04:02 +0800 Subject: [PATCH 1/2] Report BAT_CONFIG_DIR in bat --diagnostic BAT_CONFIG_DIR overrides the config directory (src/bin/bat/directories.rs) and is documented in the README, but it was missing from the environment list that bat --diagnostic prints, so a bug report never showed where bat was actually reading its config from. Extend diagnostic_sanity_check to cover it. --- src/bin/bat/main.rs | 1 + tests/integration_tests.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index 359219be..9019e9d6 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -333,6 +333,7 @@ fn invoke_bugreport(app: &App, cache_dir: &Path) -> Result<()> { .info(CommandLine::default()) .info(EnvironmentVariables::list(&[ "BAT_CACHE_PATH", + "BAT_CONFIG_DIR", "BAT_CONFIG_PATH", "BAT_OPTS", "BAT_PAGER", diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 9463be37..f4c21815 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1755,6 +1755,7 @@ fn diagnostic_sanity_check() { .success() .stdout(predicate::str::contains("BAT_PAGER=")) .stdout(predicate::str::contains("BAT_WIDTH=")) + .stdout(predicate::str::contains("BAT_CONFIG_DIR=")) .stderr(""); } From ca5eeb7c2a54165fa17779da4180628b12c7346b Mon Sep 17 00:00:00 2001 From: yuwk <1729065730@qq.com> Date: Fri, 16 Oct 2026 02:04:46 +0800 Subject: [PATCH 2/2] Add changelog entry for BAT_CONFIG_DIR in --diagnostic --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e460ad..6cc3df4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres) ## Bugfixes +- Report `BAT_CONFIG_DIR` in `bat --diagnostic`, so bug reports show a config directory that overrides `$XDG_CONFIG_HOME`. See #4068 (@ump45nose) - Exit quietly with status 0 instead of panicking when stdout is closed early (broken pipe) on auxiliary output paths such as `--completion`, `--config-file`, `--diagnostic`, `--generate-config-file`, `--set-terminal-title` and `cache --build`/`--clear`, matching the main output path since #232, closes #4034, see #4035 (@Mathjk) - Track strikethrough (SGR 9 / 29) in the ANSI style tracker so it is re-emitted like bold, dim, italic, and underline, and is no longer dropped after the first highlighted token when displaying ANSI input with syntax highlighting, see #4015 (@mikehasa) - Allow boolean flags to be given more than once, so that a flag set in the config file can also be passed on the command line without erroring, see #3912 (@logarithmone1128)