git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Documentation/git-reflog: remove unneeded \ from \{

From
Glen Choo <chooglen@google.com>
Date
Aug 10, 2022, 16:55 UTC
Message-ID
<kl6l5yj0qbqt.fsf@chooglen-macbookpro.roam.corp.google.com>
In-Reply-To
<CAMP44s2z1FC-3T0X39aT5WTq2aFGph_-iVz-yJtTN6VpG-qdzA@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 36 quoted lines
> On Mon, Aug 1, 2022 at 4:04 PM Glen Choo via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Glen Choo <chooglen@google.com>
>>
>> There are some inconsistencies with how different asciidoc environments
>> handle different combinations of "\{<>}", e.g. these results were
>> observed with asciidoc on two different environments:
>>
>>   | Input     | Output (env A) | Output (env B)   | same/different |
>>   |-----------+----------------+------------------+----------------|
>>   | \{<foo>\} | {&lt;foo&gt;}  | \{&lt;foo&gt;}^M | different      |
>>   | {<foo>}   | {&lt;foo&gt;}  | {&lt;foo&gt;}    | same           |
>>   | \{<foo>}  | {&lt;foo&gt;}  | \{&lt;foo&gt;}^M | different      |
>>   | \{foo\}   | {foo}          | {foo}            | same           |
>>   | \{\}      | {}             | \{}^M            | different      |
>>   | \{}       | {}             | {}               | same           |
>>   | {\}       | {}             | {}               | same           |
>>
>> The only instance of this biting us is "@\{<specifier>\}" in
>> Documentation/git-reflog.txt; all other combinations of "\{<>}" (e.g. in
>> Documentation/revisions.txt) seem to render consistently.
>
> So, I did some investigation. {} are used for attributes, if you do
> {manversion} that will be replaced by the manversion attribute (which
> we are setting), but if you do {foobar} (an attribute that doesn't
> exist) different implementations will do different things, what you
> should do is \{foobar} as that's how the documentation says you should
> escape attributes [1].
>
> In 552cecc214 (Teach "git reflog" a subcommand to delete single
> entries, 2007-10-17) it was {specifier} which could have been an
> attribute and thus should be quoted, but in 49cbad0edd (doc: express
> grammar placeholders between angle brackets, 2021-11-06) it was
> changed to {<specifier>} and that apparently cannot be an attribute,
> so it should not be quoted.

Aha! Thanks! I'm glad that there's a satisfying explanation for all of this :)

Show 18 quoted lines
>
> We shouldn't be using verses for this kind of stuff though, since we
> want the whole thing displayed as-is, it's better to use literal
> blocks [2], but that's a bigger change.
>
> For now it should be:
>
>   @{<specifier>}
>
> So the patch is correct. ACK.
>
> Cheers.
>
> [1] https://docs.asciidoctor.org/asciidoc/latest/attributes/reference-attributes/
> [2] https://docs.asciidoctor.org/asciidoc/latest/verbatim/literal-blocks/
>
> -- 
> Felipe Contreras
Previous: Felipe Contreras
Message 5 of 5 in “Documentation/git-reflog: remove unneeded \ from \{”
  1. Documentation/git-reflog: remove unneeded \ from \{Glen Choo via GitGitGadget, Aug 1, 2022
  2. Junio C HamanoAug 1, 2022
  3. Johannes SchindelinAug 10, 2022
  4. Felipe ContrerasAug 10, 2022
  5. Glen ChooAug 10, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.