takaaki-kasai / git-foresta

git-foresta: Text-based git log graph viewer
GNU General Public License v3.0
222 stars 11 forks source link

Support --pretty='format:...' #7

Open TamaMcGlinn opened 3 years ago

TamaMcGlinn commented 3 years ago

It seems in your very first commit, you removed support for pretty:

    "pretty=s"                => sub {}, # ignore

This is unfortunate, as that is the reason I cannot use git-foresta inside of vim-flog. Vim-flog needs to be able to insert some special characters so that it can see where the commit hash begins, so it runs:

git-forest --pretty='format:__FSTART__%D__FSEP__%h__FSEP____DSTART__%Cblue%ad%Creset %C(yellow)[%h]%Creset %Cgreen{%an}%Creset%Cred%d%Creset %s__DEND____FEND__'

I tried re-adding like so:

-    "pretty=s"                => sub {}, # ignore
+       "pretty=s"                => \$Pretty_fmt,

but it prints garbage, probably because of some special characters being used:

$ ./git-forest --pretty='format:__FSTART__%D__FSEP__%h__FSEP____DSTART__%Cblue%ad%Creset %C(yellow)[%h]%Creset %Cgreen{%an}%Creset%Cred%d%Creset %s__DEND____FEND__'
__FSTART 1970-01-01 01:00  ○
__FSTART 1970-01-01 01:00  ◎
                           ├─┐
__FSTART 1970-01-01 01:00  │ ●
                           ├─┘
__FSTART 1970-01-01 01:00  ●
__FSTART 1970-01-01 01:00  ●
(...)

Oddly enough, even if I specify what is already the default value, it fails (commit message not shown):

$ git-forest --pretty='format:%H\t%at\t%an\t%C(reset)%C(auto)%d%C(reset)\t%s'
543537c2 1970-01-01 01:00  ○
45ffea85 1970-01-01 01:00  ◎
                           ├─┐
d481a127 1970-01-01 01:00  │ ●
                           ├─┘
a16adc14 1970-01-01 01:00  ●
7031fc34 1970-01-01 01:00  ●
(...)