rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

Decorations disappear when using -format #127

Closed j-xella closed 2 months ago

j-xella commented 2 months ago

Using the latest vim-flog as of 5 July 2024. This shows tags/branch names/ etc... :

Flogsplit -all -- --decorate

And this does not:

Flogsplit -format=%as\ [%h]\ %s -all -- --decorate

Shouldn't the decorations be present in both cases?

rbong commented 2 months ago

Flog[split] -- --decorate has no bearing over whether tags/branch names are shown or not. If you try Flog[split] -- --no-decorate with the default format, ref names will still be shown.

This is because internally Flog uses the git log --format=... option to display output. You will see the same thing if you use either of these commands:

git log --graph --format="%as [%h] %s" --decorate
git log --graph --format="%as [%h] %s" --no-decorate

Looking at the format you've specified (%as [%h] %s), it doesn't have a spot to put ref names, which are specified with %d, so it couldn't possibly know where to put them. Even if it's included, --decorate does not control whether refs are shown in this case. In other words, --format overrides --decorate.

The --decorate option only controls whether ref names show up for pre-specified formats such as short or oneline, but since Flog must use a custom format, --decorate can never control whether ref names are shown. The only way you can control whether ref names are shown is to include or exclude %d from your custom format.

What you want is probably a format like this: %as%d\ [%h]\ %s

Now, --decorate can control the style of ref names in Flog. So if you want to use something like --decorate=full, that will work.