Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v12 03/13] ref-filter: introduce the ref_formatting_state stack machinery

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:06:14

Matthieu Moy [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
quoted
So I think 'quote' should apply only to the top-level atoms in the
nested %(magic)...%(end) world.
This is true in most cases, but I think there would also be use-cases
where you would want the opposite, like:

--format '
    %(if:whatever)
    echo %(refname)
    %(end)
'

I'm not sure what's best, but if both can make sense, perhaps we should
just keep the simplest to implement, i.e. the current behavior.
I am reasonably sure what's best, as --{shell,tcl,...} with --format
is my invention ;-)

The whole point of these "language specific quotes" to have
"--format" output to be an executable script is so that the user can
express control in that scripting language.  We must be able process
the examples in the message you are responding to, i.e. allowing
%(atom) and %(magic)...%(end) correctly assigned to a variable of
the target language.  If that implementation happens to also grok
your "%(if:whatever)...%(then)echo %(refname)%(end)" example in a
way you expect, that would be great, but if not, then I do not think
it is worth worrying about it.  On the other hand, a solution that
does not solve the primary use case is worthless, even if it is
simple to implement.

I do not think we deeply mind if we forbid use if %(if)...%(end)
when quoting is in use, if the current implementation too broken
beyond salvaging.  I however think that %(align:40)%(atom)%(end)
would want to be usable even with quoting, and I suspect that an
implementation that groks %(align) correctly would automatically
grok %(if), too.

So...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help