Open bric3 opened 4 years ago
git log -1 --graph --patch
✅ git log -1 --patch
🔴 Hi @bric3, thanks for this! I agree it's not working and I agree it would make sense for it to work in principle.
Regarding implementation, the parser currently does not have any concept of "being in log --graph
mode" and does not handle the possibility that each line starts with an arbitrary number of | | | ...
markers corresponding to an arbitrary number of branch lineages.
Incidentally, do you find it helpful to use log --patch
in conjunction with log --graph
or would you say that they people would normally use them separately?
Incidentally, do you find it helpful to use
log --patch
in conjunction withlog --graph
or would you say that they people would normally use them separately?
Actually I usually don't do that as I'm using the git alias which happens to use the --graph
, and sometimes I want to see the patch of a commit by adding the -p
option. I guess it's a limitation of the pager
way of doing things. I wonder of git could have a some way to render the diff.
But if this has to be implemnted I think using the star *
before a commit to distinguish between graph mode or normal mode may be a clue to achieve that. I know the diff-highlight script does something like that https://github.com/git/git/commit/4551fbba141e0b2e4d16830f76f784e9c960bdf8. Although I recognize it's ultimately a tad complex.
Incidentally, do you find it helpful to use
log --patch
in conjunction withlog --graph
or would you say that they people would normally use them separately?
I'm using both at the same time, mainly because I have a git alias that reformats the commits info, body, and also enables graph.
And when I want to see the patch diff of each commits I just add -p
to that alias.
I tested with delta 0.13.0, it's not yet working.
How difficult is the rest of the work needed to have this feature?
I also wanted this to be able to add --patch
to my git log aliases. So instead I ended up making new aliases for the --patch
use cases:
[alias]
# log (short and long)
l = log --graph --pretty=format:'%C(auto)%h %C(bold)%cs%C(auto) %C(blue)%an:%C(auto)%d %s' --color=always
la = l --all
ll = log --graph --pretty=fuller --abbrev-commit --color=always
lla = ll --all
# versions of log aliases with "--patch"
# - they duplicate the "l" and "ll" aliases wtihout "--graph" since
# it's not compatible with git-delta
lp = log --pretty=format:'%C(auto)%h %C(bold)%cs%C(auto) %C(blue)%an:%C(auto)%d %s' --color=always --patch
lap = lp --all
llp = log --pretty=fuller --abbrev-commit --color=always --patch
llap = llp --all
Until delta
supports --graph
, I just fall back to difftastic
:
lg-dt = "!DFT_IGNORE_COMMENTS= git -c diff.external=difft log --graph --date=local --decorate --patch --ext-diff"
show-dt = "!DFT_IGNORE_COMMENTS= git -c diff.external=difft show --patch --ext-diff"
Hi I believe I came across an issue, but I'm not sure. I've configured
delta
this way in my.gitconfig
I have this alias as well
I narrowed the issue to the
--graph
option, when it's used, delta somehow back out