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

Re: [PATCH 2/4] doc: allow literal and emphasis format in doc vs help tests

From
Jeff King <peff@peff.net>
Date
Mar 28, 2024, 10:06 UTC
Message-ID
<20240328100658.GA883510@coredump.intra.peff.net>
In-Reply-To
<202ed891463c134904b89a0d746d85bb62338d52.1711318739.git.gitgitgadget@gmail.com>
On Sun, Mar 24, 2024 at 10:18:57PM +0000, Jean-Noël Avila via GitGitGadget wrote:
Show 21 quoted lines
> From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>
> 
> As the new formatting of literal and placeholders is introduced,
> the synopsis in the man pages can now hold additional markup with
> respect to the command help.
> 
> Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> ---
>  t/t0450-txt-doc-vs-help.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
> index cd3969e852b..e47599cbf26 100755
> --- a/t/t0450-txt-doc-vs-help.sh
> +++ b/t/t0450-txt-doc-vs-help.sh
> @@ -59,7 +59,7 @@ txt_to_synopsis () {
>  		-e '/^\[verse\]$/,/^$/ {
>  			/^$/d;
>  			/^\[verse\]$/d;
> -
> +			s/{empty}\|_\|`//g;
It looks like this doesn't work in the macos CI jobs. E.g., this run:
  https://github.com/git/git/actions/runs/8460326247/job/23178326007
produced output from t0450 like:
  +++ diff -u txt help
  --- txt    2024-03-28 00:14:15
  +++ help   2024-03-28 00:14:15
  @@ -1,5 +1,5 @@
  -`git init` [`-q` | `--quiet`] [`--bare`] [`--template=`{empty}__<template-directory>__]
  -         [`--separate-git-dir` _<git-dir>_] [`--object-format=`{empty}__<format>__]
  -         [`--ref-format=`{empty}__<format>__]
  -         [`-b` _<branch-name>_ | `--initial-branch=`{empty}__<branch-name>__]
  -         [`--shared`[`=`{empty}__<permissions>__]] [_<directory>_]
  +git init [-q | --quiet] [--bare] [--template=<template-directory>]
  +         [--separate-git-dir <git-dir>] [--object-format=<format>]
  +         [--ref-format=<format>]
  +         [-b <branch-name> | --initial-branch=<branch-name>]
  +         [--shared[=<permissions>]] [<directory>]

I think the issue is that "|" alternation is not portable. In GNU sed, doing "\|" with BRE is enough, but in BSD sed you need to enable ERE with "-E". I'm not sure how portable that is (we do seem to have at least one instance in t6030, so maybe it's OK). The most basic alternative is just splitting it like:

  s/{empty}//g;
  s/[_`]//g;
-Peff
Previous: Jean-Noël Avila via GitGitGadgetNext: Eric Sunshine
Message 4 of 21 in “Doc new guidelines”
  1. 0/4 Doc new guidelinesJean-Noël Avila via GitGitGadget, Mar 24, 2024
  2. 1/4 doc: rework CodingGuidelines with new formatting rulesJean-Noël Avila via GitGitGadget, Mar 24, 2024
  3. 2/4 doc: allow literal and emphasis format in doc vs help testsJean-Noël Avila via GitGitGadget, Mar 24, 2024
  4. Jeff KingMar 28, 2024
  5. Eric SunshineMar 28, 2024
  6. 3/4 doc: git-init: apply new documentation formatting guidelinesJean-Noël Avila via GitGitGadget, Mar 24, 2024
  7. Martin ÅgrenMar 26, 2024
  8. Jean-Noël AVILAMar 26, 2024
  9. 4/4 doc: git-clone: apply new documentation guidelinesJean-Noël Avila via GitGitGadget, Mar 24, 2024
  10. Martin ÅgrenMar 26, 2024
  11. Junio C HamanoMar 26, 2024
  12. Jean-Noël AVILAMar 26, 2024
  13. Junio C HamanoMar 26, 2024
  14. 0/5 Doc new guidelinesJean-Noël Avila via GitGitGadget, Mar 29, 2024
  15. 1/5 doc: rework CodingGuidelines with new formatting rulesJean-Noël Avila via GitGitGadget, Mar 29, 2024
  16. Eric SunshineMar 29, 2024
  17. Jean-Noël AVILAMar 30, 2024
  18. 2/5 doc: allow literal and emphasis format in doc vs help testsJean-Noël Avila via GitGitGadget, Mar 29, 2024
  19. 3/5 doc: git-init: apply new documentation formatting guidelinesJean-Noël Avila via GitGitGadget, Mar 29, 2024
  20. 5/5 doc: git-clone: do not autoreference the manpage in itselfJean-Noël Avila via GitGitGadget, Mar 29, 2024
  21. 4/5 doc: git-clone: apply new documentation formatting guidelinesJean-Noël Avila via GitGitGadget, Mar 29, 2024

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.