Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
sandr01d opened this issue Jan 10, 2023 · 4 comments
Open
2 tasks done

Comments

@sandr01d
Copy link

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.

  • Please include the raw text output from git, so that we can reproduce the problem.
    (You can use git --no-pager to produce the raw text output.)
ca769c23 (Wenxuan Zhang 2021-03-01  1) The MIT License (MIT)
ca769c23 (Wenxuan Zhang 2021-03-01  2) 
ca769c23 (Wenxuan Zhang 2021-03-01  3) Copyright © 2017-2021 Wenxuan Zhang <[email protected]>
ca769c23 (Wenxuan Zhang 2021-03-01  4) 
ca769c23 (Wenxuan Zhang 2021-03-01  5) Permission is hereby granted, free of charge, to any person obtaining a copy
ca769c23 (Wenxuan Zhang 2021-03-01  6) of this software and associated documentation files (the “Software”), to deal
ca769c23 (Wenxuan Zhang 2021-03-01  7) in the Software without restriction, including without limitation the rights
ca769c23 (Wenxuan Zhang 2021-03-01  8) to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
ca769c23 (Wenxuan Zhang 2021-03-01  9) copies of the Software, and to permit persons to whom the Software is
ca769c23 (Wenxuan Zhang 2021-03-01 10) furnished to do so, subject to the following conditions:
ca769c23 (Wenxuan Zhang 2021-03-01 11) 
ca769c23 (Wenxuan Zhang 2021-03-01 12) The above copyright notice and this permission notice shall be included in
ca769c23 (Wenxuan Zhang 2021-03-01 13) all copies or substantial portions of the Software.
ca769c23 (Wenxuan Zhang 2021-03-01 14) 
ca769c23 (Wenxuan Zhang 2021-03-01 15) THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
ca769c23 (Wenxuan Zhang 2021-03-01 16) IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ca769c23 (Wenxuan Zhang 2021-03-01 17) FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
ca769c23 (Wenxuan Zhang 2021-03-01 18) AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
ca769c23 (Wenxuan Zhang 2021-03-01 19) LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ca769c23 (Wenxuan Zhang 2021-03-01 20) OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
ca769c23 (Wenxuan Zhang 2021-03-01 21) THE SOFTWARE.
  • A screenshot of Delta's output is often helpful also.

I've created an asciinema here:

asciicast

@stevielavern
Copy link

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
Copy link
Contributor

dvermd commented Aug 26, 2024

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

@dvermd
Copy link
Contributor

dvermd commented Aug 26, 2024

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
Copy link
Collaborator

th1000s commented Sep 8, 2024

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

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

No branches or pull requests

4 participants