dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.36k stars 360 forks source link

Fix panic when blame-palette is empty #1737

Open thorio opened 3 days ago

thorio commented 3 days ago

Currently, when blame-palette is set to an empty string, the application panics:

$ git blame ARCHITECTURE.md | delta --blame-palette ""
thread 'main' panicked at src/handlers/blame.rs:175:47:
attempt to calculate the remainder with a divisor of zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This patch replaces this with a nicer error message:

$ git blame ARCHITECTURE.md | delta --blame-palette ""
Option 'blame-palette' must not be empty.