dandavison / delta

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

🐛 When using --date with git blame delta, the output is not colored #1278

Open sandr01d opened 1 year ago

sandr01d commented 1 year ago

When using the --date option with git blame, delta does not color the output when the value is anything other than iso8601 or iso8601-local. E.g. git blame --date=short FILENAME does not produce colored output, while git blame --date=iso8601 FILENAME does.

I've created an asciinema here:

asciicast

stevielavern commented 10 months ago

Not sure if this helps, but delta supports this option:

      --blame-timestamp-output-format <FMT>
          Format string for git blame timestamp output.

          This string is used for formatting the timestamps in git blame output. It must follow the `strftime` format syntax specification. If it is not present, the timestamps will be formatted in a human-friendly but possibly less accurate form.

          See: (https://docs.rs/chrono/latest/chrono/format/strftime/index.html)

For instance, to have absolute dates by default, put this in .gitconfig:

[delta]
    blame-timestamp-output-format = %c
dvermd commented 3 weeks ago

Using the -t option also doesn't produce colored output

dvermd commented 3 weeks ago

The timestamp on the blame line is parsed with this regex which parses the timestamp as [0-9]{4}-[0-9]{2}-[0-9]{2}\ [0-9]{2}:[0-9]{2}:[0-9]{2}\ [-+][0-9]{4}.

There are many standard formats for --date parameter. These and the -t option could be tried alternatively with one or many regex but the --date=format:... won't be parseable this way.

th1000s commented 1 week ago

The regex should accept more formats with #925, but supporting the various --date options needs more robust parsing.