Open unphased opened 2 years ago
Is the following an accurate summary?
commit-style = raw
allows git's raw colors for commit SHA, HEAD, local, and remote branch names to be displayed by deltaThis ticket calls for the two things to be possible in conjunction.
Thank you for summarizing!
I am not certain that the first bullet is entirely the case. Is raw the default? I seem to recall from my testing that when I made git emit colors that these git colors overrode, even when the delta commit-style was set.
Yep, raw is the default
~ delta --no-gitconfig --show-config | grep commit-style
commit-style = raw
and I believe it works; try git show --color=always --decorate | delta --no-gitconfig
(I found that git show
doesn't emit the decorated refs if it's output is redirected to a pipe unless we pass --decorate
)
I've run into a similar issue. It looks like there's some discrepancy between how the colours are handled for git show
and git log
.
I've been debugging it for a while, and it seems that there's an issue with how delta is used from git, and not with the git+delta combination on its own.
Format string:
--pretty=format:" %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset"
git show
to delta
) - works as desired:git show --color=always --decorate --pretty=format:" %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" | delta --no-gitconfig
git show
manually; rely on automatic formatting) - no colour but format is fine:git show --color=always --decorate --pretty=format:" %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset"
git log -p
manually; rely on automatic formatting) - works as desired:git log -p --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset"
TLDR; I would like git show
to use the formatting string correctly, just like git log
does.
I'm using a very basic configuration in .gitconfig
:
[core]
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
side-by-side = true
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
I noticed that when I set the
settings, the entire commit line becomes yellow. Including any indicators for HEAD, local or remote branch names.
I would like these to be made visually distinct for easier reading. I noticed that it's possible to use
--pretty=format
here.I have tried using this format which I directly copied out of my short git graph log configuration:
--pretty=format:'%C(bold magenta)%h%Creset -%C(auto)%d%Creset %s %Cgreen%ci %C(yellow)(%cr) %C(bold blue)<%an>%Creset'
And it looks like:
This works, but completely overrides delta's configured commit styles.
I feel like in the past I had this working prior to discovering Delta, but now I wonder if I may be mistaken about that and i always just had them yellow.
Anyways, since it overrides, there is no way to configure the colors precisely this way and gain the benefits of Delta's styling such as boxes. Let's say I wanted box decoration. I don't, to save space, but somebody might.
In the meantime (and in the future I reckon) I will use it like I have it now with
--pretty=format
but tweaked a bit (needs more yellow) to suit my needs. This ticket is regarding whether to do anything about the intersection between git's styling and Delta's styling.