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

🐛 git blame -C loses syntax highlighting #1803

Open
rmacklin opened this issue Aug 14, 2024 · 3 comments · May be fixed by #1829
Open

🐛 git blame -C loses syntax highlighting #1803

rmacklin opened this issue Aug 14, 2024 · 3 comments · May be fixed by #1829

Comments

@rmacklin
Copy link

The -C flag for git blame is useful for tracking blame beyond code that was moved from one file to another. Unfortunately, it seems to cause delta to lose its syntax highlighting - the blame still has grouped background highlights in different shades of gray, but the code itself isn't highlighted. Here is an asciinema recording demonstrating the issue by running git blame src/handlers/blame.rs and git blame -C src/handlers/blame.rs in a clone of this repository (at commit a01141b):

asciicast

@rmacklin
Copy link
Author

@rmacklin
Copy link
Author

rmacklin commented Aug 14, 2024

Hmm, this just got even weirder. If I run git blame -C -w src/handlers/blame.rs it works with syntax highlighting. But...swapping the order of those flags to git blame -w -C src/handlers/blame.rs has no syntax highlighting. Perhaps the issue only occurs if -C is the last flag...? 🤔

@th1000s
Copy link
Collaborator

th1000s commented Aug 15, 2024

Nice find! The blame output does not mention the file type, so delta uses the git blame command line to find it. It seems -C is not handled correctly in all cases, see guess_git_blame_filename_extension(..) in src/utils/process.rs:117.

dvermd added a commit to dvermd/delta that referenced this issue Aug 26, 2024
@dvermd dvermd linked a pull request Aug 26, 2024 that will close this issue
dvermd added a commit to dvermd/delta that referenced this issue Sep 10, 2024
dvermd added a commit to dvermd/delta that referenced this issue Sep 15, 2024
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 a pull request may close this issue.

2 participants