Re: log --format existence of notes?
- From
Bence Ferdinandy <bence@ferdinandy.com>
- Date
- Nov 16, 2024, 15:11 UTC
- Message-ID
- <D5NP6QUUBWBL.7OUG34RUIE2S@ferdinandy.com>
- In-Reply-To
- <xmqqsersyrch.fsf@gitster.g>
On Sat Nov 16, 2024 at 01:06, Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> "Bence Ferdinandy" <bence@ferdinandy.com> writes: > >> based on the man pages it doesn't seem possible, but maybe I'm missing something. >> >> I would like to put together a "log --format=" which is similar to --oneline, >> but where if there's a note for the commit it's marked with e.g. a notebook >> symbol. There's %N, but that prints the entire note, so it doesn't work well >> with one commit per line. > > I do not think it is doable. Unlike the format language in the > for-each-ref/branch --list family of commands, the pretty-format > language in the log family of commands lack more involved > conditional formatting features. > > Unifying these two formatting languages to port features from one to > the other would be needed, I guess.
Is this already on the roadmap with a plan on how to do it? It sounds like switching log format to the same formatting as the other commands would make life easier in the long run.
Show 6 quoted lines
> If we had a note support in the > latter, something like > > $ git branch -l --format='%(subject)%(if)%(note:amlog)%(then)📓%(end)' > > may have worked.
Conditional formatting definitely would sound useful for logs as well :)
On the other hand: would a quick win in analogy to "%G?" be considered? A "%N?" that either outputs a "N" for note and a "-" for no note? Or something like that. A bit ugly, but gets the job done.
Thanks, Bence