Doc new guidelines
cover Doc new guidelines
This is hopefully the final rehearsal of documentation style rework before the reroll on the all the man pages.
Following some more research on how man pages are usually formatted and on our track record of editing our documentation, this series states as the new standard that all literal text is now formatted in verbatim and that placeholders are emphasized, wherever they appear.
The markup is a bit more involved in some cases, but the output is more consistent and follows the principle of least surprise for readers accustomed to reading man pages.
Jean-Noël Avila (4):
doc: rework CodingGuidelines with new formatting rules
doc: allow literal and emphasis format in doc vs help tests
doc: git-init: apply new documentation formatting guidelines
doc: git-clone: apply new documentation guidelines
Documentation/CodingGuidelines | 147 ++++++++++++++++++--------------- Documentation/config/clone.txt | 23 ++++-- Documentation/config/init.txt | 4 +- Documentation/git-clone.txt | 120 +++++++++++++-------------- Documentation/git-init.txt | 46 +++++------ Documentation/urls.txt | 22 ++--- t/t0450-txt-doc-vs-help.sh | 2 +- 7 files changed, 193 insertions(+), 171 deletions(-)
base-commit: 11c821f2f2a31e70fb5cc449f9a29401c333aad2
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1702%2Fjnavila%2Fdoc_new_Guidelines-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1702/jnavila/doc_new_Guidelines-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1702
Signature · 1 line
gitgitgadget
PATCH 1/4 doc: rework CodingGuidelines with new formatting rules
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
Literal and placeholder formatting is more heavily enforced, with some asciidoc magic. Basically, the markup is preserved everywhere.
--- Documentation/CodingGuidelines | 147 ++++++++++++++++++--------------- 1 file changed, 79 insertions(+), 68 deletions(-)
Documentation/CodingGuidelines +79 -68
@@ -641,15 +641,15 @@ Writing Documentation: - Prefer succinctness and matter-of-factly describing functionality in the abstract. E.g. - --short:: Emit output in the short-format. + `--short`:: Emit output in the short-format. and avoid something like these overly verbose alternatives: - --short:: Use this to emit output in the short-format. - --short:: You can use this to get output in the short-format. - --short:: A user who prefers shorter output could.... - --short:: Should a person and/or program want shorter output, he - she/they/it can... + `--short`:: Use this to emit output in the short-format. + `--short`:: You can use this to get output in the short-format. + `--short`:: A user who prefers shorter output could.... + `--short`:: Should a person and/or program want shorter output, he + she/they/it can... This practice often eliminates the need to involve human actors in your description, but it is a good practice regardless of the
@@ -659,12 +659,12 @@ Writing Documentation: addressing the hypothetical user, and possibly "we" when discussing how the program might react to the user. E.g. - You can use this option instead of --xyz, but we might remove + You can use this option instead of `--xyz`, but we might remove support for it in future versions. while keeping in mind that you can probably be less verbose, e.g. - Use this instead of --xyz. This option might be removed in future + Use this instead of `--xyz`. This option might be removed in future versions. - If you still need to refer to an example person that is
@@ -682,68 +682,112 @@ Writing Documentation: The same general rule as for code applies -- imitate the existing conventions. - A few commented examples follow to provide reference when writing or - modifying command usage strings and synopsis sections in the manual - pages: - Placeholders are spelled in lowercase and enclosed in angle brackets: - <file> - --sort=<key> - --abbrev[=<n>] +Markup: + + Literal parts (e.g. use of command-line options, command names, + branch names, URLs, pathnames (files and directories), configuration and + environment variables) must be typeset as verbatim (i.e. wrapped with + backticks): + `--pretty=oneline` + `git rev-list` + `remote.pushDefault` + `http://git.example.com` + `.git/config` + `GIT_DIR` + `HEAD` + + An environment variable must be prefixed with "$" only when referring to its + value and not when referring to the variable itself, in this case there is + nothing to add except the backticks: + `GIT_DIR` is specified + `$GIT_DIR/hooks/pre-receive` + + Word phrases enclosed in `backtick characters` are rendered literally + and will not be further expanded. The use of `backticks` to achieve the + previous rule means that literal examples should not use AsciiDoc + escapes. + Correct: + `--pretty=oneline` + Incorrect: + `\--pretty=oneline` + + Placeholders are spelled in lowercase and enclosed in + angle brackets surrounded by underscores: + _<file>_ + _<commit>_ If a placeholder has multiple words, they are separated by dashes: - <new-branch-name> - --template=<template-directory> + _<new-branch-name>_ + _<template-directory>_ + + A placeholder is not enclosed in backticks, as it is not a literal. + + When needed, use a distinctive identifier for placeholders, usually + made of a qualification and a type: + _<git-dir>_ + _<key-id>_ + + When literal and placeholders are mixed, each markup is applied for + each sub-entity. If they are stuck, a special markup, with an {empty} + entity is needed: + `--jobs` _<n>_ + `--sort=`{empty}__<key>__ + __<directory>__{empty}`/.git` + `remote.`{empty}__<name>__{empty}`.mirror` + +Synopsis Syntax - When a placeholder is cited in text paragraph, it is enclosed in angle - brackets to remind the reader the reference in the synopsis section. - For better visibility, the placeholder is typeset in italics: - The _<file>_ to be added. + Syntax grammar is formatted neither as literal nor as placeholder. + + A few commented examples follow to provide reference when writing or + modifying command usage strings and synopsis sections in the manual + pages: Possibility of multiple occurrences is indicated by three dots: - <file>... + _<file>_... (One or more of <file>.) Optional parts are enclosed in square brackets: - [<file>...] + [_<file>_...] (Zero or more of <file>.) - --exec-path[=<path>] + `--exec-path`[`=`{empty}__<path>__] (Option with an optional argument. Note that the "=" is inside the brackets.) - [<patch>...] + [_<patch>_...] (Zero or more of <patch>. Note that the dots are inside, not outside the brackets.) Multiple alternatives are indicated with vertical bars: - [-q | --quiet] - [--utf8 | --no-utf8] + [`-q` | `--quiet`] + [`--utf8` | `--no-utf8`] Use spacing around "|" token(s), but not immediately after opening or before closing a [] or () pair: - Do: [-q | --quiet] - Don't: [-q|--quiet] + Do: [`-q` | `--quiet`] + Don't: [`-q`|`--quiet`] Don't use spacing around "|" tokens when they're used to separate the alternate arguments of an option: - Do: --track[=(direct|inherit)] - Don't: --track[=(direct | inherit)] + Do: `--track`[`=`(`direct`|`inherit`)]` + Don't: `--track`[`=`(`direct` | `inherit`)] Parentheses are used for grouping: - [(<rev> | <range>)...] + [(_<rev>_ | _<range>_)...] (Any number of either <rev> or <range>. Parens are needed to make it clear that "..." pertains to both <rev> and <range>.) - [(-p <parent>)...] + [(`-p` _<parent>_)...] (Any number of option -p, each with one <parent> argument.) - git remote set-head <name> (-a | -d | <branch>) + `git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_) (One and only one of "-a", "-d" or "<branch>" _must_ (no square brackets) be provided.) And a somewhat more contrived example: - --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] + `--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]` Here "=" is outside the brackets, because "--diff-filter=" is a valid usage. "*" has its own pair of brackets, because it can (optionally) be specified only when one or more of the letters is
@@ -754,39 +798,6 @@ Writing Documentation: the user would type into a shell and use 'Git' (uppercase first letter) when talking about the version control system and its properties. - A few commented examples follow to provide reference when writing or - modifying paragraphs or option/command explanations that contain options - or commands: - - Literal examples (e.g. use of command-line options, command names, - branch names, URLs, pathnames (files and directories), configuration and - environment variables) must be typeset in monospace (i.e. wrapped with - backticks): - `--pretty=oneline` - `git rev-list` - `remote.pushDefault` - `http://git.example.com` - `.git/config` - `GIT_DIR` - `HEAD` - - An environment variable must be prefixed with "$" only when referring to its - value and not when referring to the variable itself, in this case there is - nothing to add except the backticks: - `GIT_DIR` is specified - `$GIT_DIR/hooks/pre-receive` - - Word phrases enclosed in `backtick characters` are rendered literally - and will not be further expanded. The use of `backticks` to achieve the - previous rule means that literal examples should not use AsciiDoc - escapes. - Correct: - `--pretty=oneline` - Incorrect: - `\--pretty=oneline` - -A placeholder is not enclosed in backticks, as it is not a literal. - If some place in the documentation needs to typeset a command usage example with inline substitutions, it is fine to use +monospaced and inline substituted text+ instead of `monospaced literal text`, and with
Signature · 1 line
gitgitgadget
PATCH 2/4 doc: allow literal and emphasis format in doc vs help tests
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
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.
--- t/t0450-txt-doc-vs-help.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t0450-txt-doc-vs-help.sh +1 -1
@@ -59,7 +59,7 @@ txt_to_synopsis () { -e '/^\[verse\]$/,/^$/ { /^$/d; /^\[verse\]$/d; - + s/{empty}\|_\|`//g; s/{litdd}/--/g; s/'\''\(git[ a-z-]*\)'\''/\1/g;
Signature · 1 line
gitgitgadget
Re: [PATCH 2/4] doc: allow literal and emphasis format in doc vs help tests
Quoted 16 lines · Jean-Noël Avila via GitGitGadget
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
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 <[email protected]>--- t/t0450-txt-doc-vs-help.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)t/t0450-txt-doc-vs-help.sh +0
-0
t/t0450-txt-doc-vs-help.sh txt_to_synopsis () { · line 62
Quoted 5 lines
t/t0450-txt-doc-vs-help.sh +1
-1@@ -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
Re: [PATCH 2/4] doc: allow literal and emphasis format in doc vs help tests
Quoted 10 lines · Jeff King
Quoted 1 line · Jean-Noël Avila via GitGitGadget
+ s/{empty}\|_\|`//g;
It looks like this doesn't work in the macos CI jobs. E.g., this run:
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:
After reading a patch very recently which used sed -E, but before responding that it was not portable and wouldn't work on macOS, I did a bit of research and was surprised to find that it is POSIX, and that (at least) relatively recent macOS does support it. I recall that I also spotted the existing instance in t6030, thus didn't respond after all.
Quoted 2 lines
s/{empty}//g;
s/[_`]//g;That said, I'm not sure how recently macOS started supporting sed -E, so what you propose here may be a good idea anyhow; and it's certainly going to be more portable done this way.
PATCH 3/4 doc: git-init: apply new documentation formatting guidelines
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
--- Documentation/config/init.txt | 4 +-- Documentation/git-init.txt | 46 +++++++++++++++++------------------ 2 files changed, 25 insertions(+), 25 deletions(-)
Documentation/config/init.txt +2 -2
@@ -3,8 +3,8 @@ ifndef::git-init[] :see-git-init: (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].) endif::[] -init.templateDir:: +`init.templateDir`:: Specify the directory from which templates will be copied. {see-git-init} -init.defaultBranch:: +`init.defaultBranch`:: Allows overriding the default branch name e.g. when initializing a new repository.
Documentation/git-init.txt +23 -23
111 lines not on this page · raw message
Signature · 1 line
gitgitgadget
Re: [PATCH 3/4] doc: git-init: apply new documentation formatting guidelines
Documentation/git-init.txt The option can have the following values, defaulting to `group` if no value · line 103
Quoted 4 lines · Jean-Noël Avila via GitGitGadget
Documentation/git-init.txt +2
-2-umask:: -false:: +`umask`:: +`false`::
(It should be umask here exactly as you did, ok, good.)
Quoted 5 lines
Use permissions reported by umask(2). The default, when
--sharedis not specified._<perm>_ is a 3-digit octal number prefixed with
0and each file will have mode _<perm>_. _<perm>_ will override users'umask(2)
It's a bit of a mix whether umask(2) should be umask(2) with backticks or just umask(2) without. That's pretty much the only thing I noticed, everything else looks really nice and consistent. I guess it's not a literal, since we don't expect to user to actually type the 8 characters "umask(2)"? If you do decide to drop the backticks, notice that there's one instance (seen above) of "users'umask(2)" with a missing space, so you might want to fix that up at the same time.
Martin
Re: [PATCH 3/4] doc: git-init: apply new documentation formatting guidelines
Quoted 23 lines · Le mardi 26 mars 2024, 21:18:31 CET Martin Ågren a écrit :
Documentation/git-init.txt The option can have the following values, defaulting to `group` if no value · line 103
Quoted 4 lines · Jean-Noël Avila via GitGitGadget
Documentation/git-init.txt +2
-2-umask:: -false:: +`umask`:: +`false`::(It should be
umaskhere exactly as you did, ok, good.)Quoted 5 lines
Use permissions reported by umask(2). The default, when
--sharedis not specified._<perm>_ is a 3-digit octal number prefixed with
0and each file will have mode _<perm>_. _<perm>_ will override users'umask(2)It's a bit of a mix whether umask(2) should be
umask(2)with backticks or just umask(2) without. That's pretty much the only thing I noticed, everything else looks really nice and consistent. I guess it's not a literal, since we don't expect to user to actually type the 8 characters "umask(2)"? If you do decide to drop the backticks, notice that there's one instance (seen above) of "users'umask(2)" with a missing space, so you might want to fix that up at the same time.
Quoted 2 lines
Martin
Ah. Good point! As we are referring to the manpage of a function, this *is* indeed a case of verbatim text so, it must be backquoted.
So, I'll add it the guidelines and reroll with changes in the man pages.
Thanks
PATCH 4/4 doc: git-clone: apply new documentation guidelines
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
Heavily apply literal and placeholder markup everywhere.
--- Documentation/config/clone.txt | 23 +++++-- Documentation/git-clone.txt | 120 ++++++++++++++++----------------- Documentation/urls.txt | 22 +++--- 3 files changed, 88 insertions(+), 77 deletions(-)
Documentation/config/clone.txt +16 -7
@@ -1,13 +1,22 @@ -clone.defaultRemoteName:: +`clone.defaultRemoteName`:: The name of the remote to create when cloning a repository. Defaults to - `origin`, and can be overridden by passing the `--origin` command-line + `origin`. +ifdef::git-clone[] + It can be overridden by passing the `--origin` command-line + option. +endif::[] +ifndef::git-clone[] + It can be overridden by passing the `--origin` command-line option to linkgit:git-clone[1]. +endif::[] +`clone.rejectShallow`:: + Reject cloning a repository if it is a shallow one. This can be overridden by + passing the `--reject-shallow` option on the command line. +ifndef::git-clone[] + See linkgit:git-clone[1] +endif::[] -clone.rejectShallow:: - Reject cloning a repository if it is a shallow one; this can be overridden by - passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1] - -clone.filterSubmodules:: +`clone.filterSubmodules`:: If a partial clone filter is provided (see `--filter` in linkgit:git-rev-list[1]) and `--recurse-submodules` is used, also apply the filter to submodules.
Documentation/git-clone.txt +60 -60
310 lines not on this page · raw message
Documentation/urls.txt +12 -10
@@ -57,11 +57,11 @@ endif::git-clone[] accept a suitable bundle file. See linkgit:git-bundle[1]. When Git doesn't know how to handle a certain transport protocol, it -attempts to use the `remote-<transport>` remote helper, if one +attempts to use the `remote-`{empty}__<transport>__ remote helper, if one exists. To explicitly request a remote helper, the following syntax may be used: -- _<transport>_::_<address>_ +- _<transport>_::__<address>__ where _<address>_ may be a path, a server and path, or an arbitrary URL-like string recognized by the specific remote helper being
@@ -72,10 +72,11 @@ you want to use a different format for them (such that the URLs you use will be rewritten into URLs that work), you can create a configuration section of the form: ------------- - [url "<actual-url-base>"] - insteadOf = <other-url-base> ------------- +[verse] +-- + [url "__<actual-url-base>__"] + insteadOf = _<other-url-base>_ +-- For example, with this:
@@ -91,10 +92,11 @@ rewritten in any context that takes a URL to be "git://git.host.xz/repo.git". If you want to rewrite URLs for push only, you can create a configuration section of the form: ------------- - [url "<actual-url-base>"] - pushInsteadOf = <other-url-base> ------------- +[verse] +-- + [url "__<actual-url-base>__"] + pushInsteadOf = _<other-url-base>_ +-- For example, with this:
Signature · 1 line
gitgitgadget
Re: [PATCH 4/4] doc: git-clone: apply new documentation guidelines
Thanks for working on this. This renders really nicely.
Quoted 20 lines · Jean-Noël Avila via GitGitGadget
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
Heavily apply literal and placeholder markup everywhere.
Signed-off-by Jean-Noël Avila <[email protected]>--- Documentation/config/clone.txt | 23 +++++-- Documentation/git-clone.txt | 120 ++++++++++++++++----------------- Documentation/urls.txt | 22 +++--- 3 files changed, 88 insertions(+), 77 deletions(-)Documentation/config/clone.txt +1
-1@@ -1,13 +1,22 @@ -clone.defaultRemoteName:: +`clone.defaultRemoteName`:: The name of the remote to create when cloning a repository. Defaults to
Documentation/config/clone.txt line 11
Quoted 10 lines
Documentation/config/clone.txt +8
-1- `origin`, and can be overridden by passing the `--origin` command-line + `origin`. +ifdef::git-clone[] + It can be overridden by passing the `--origin` command-line + option. +endif::[] +ifndef::git-clone[] + It can be overridden by passing the `--origin` command-line option to linkgit:git-clone[1]. +endif::[]
There's a bit more going on here than the commit message claims. FWIW, I think these changes are good, even if maybe a bit surprising.
Quoted 8 lines
Documentation/config/clone.txt +0
-8-'git clone' [--template=<template-directory>] - [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] - [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>] - [--dissociate] [--separate-git-dir <git-dir>] - [--depth <depth>] [--[no-]single-branch] [--no-tags] - [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules] - [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow] - [--filter=<filter> [--also-filter-submodules]] [--] <repository>
Documentation/config/clone.txt line 20
Quoted 10 lines
Documentation/config/clone.txt +9
-1- [<directory>] +`git clone` [`--template=`{empty}__<template-directory>__] + [`-l`] [`-s`] [`--no-hardlinks`] [`-q`] [`-n`] [`--bare`] [`--mirror`] + [`-o` _<name>_] [`-b` _<name>_] [`-u` _<upload-pack>_] [`--reference` _<repository>_] + [`--dissociate`] [`--separate-git-dir` _<git-dir>_] + [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-tags`] + [`--recurse-submodules`[`=`{empty}__<pathspec>__]] [`--`[`no-`]`shallow-submodules`] + [`--`[`no-`]`remote-submodules`] [`--jobs` _<n>_] [`--sparse`] [`--`[`no-`]`reject-shallow`] + [`--filter=`{empty}__<filter-spec>__] [`--also-filter-submodules`]] [`--`] _<repository>_ + [_<directory>_]
Don't ask me why, but I need this on top (whitespace-damaged)
- [--depth _<depth>_] [--[no-]single-branch] [--no-tags]
- [--recurse-submodules[={empty}__<pathspec>__]]
[--[no-]shallow-submodules]
- [--[no-]remote-submodules] [--jobs _<n>_]
[--sparse] [--[no-]reject-shallow]
+ [--depth _<depth>_] [--[no-]{empty}single-branch]
[--no-tags]
+ [--recurse-submodules[={empty}__<pathspec>__]]
[--[no-]{empty}shallow-submodules]
+ [--[no-]{empty}remote-submodules] [--jobs _<n>_]
[--sparse] [--[no-]{empty}reject-shallow]
i.e., some sprinkling of "{empty}", to keep each of these "[--[no-]" from simply disappearing. This is with Asciidoctor 1.5.5, which is admittedly starting to get old, but still ok as per our INSTALL document.
Documentation/config/clone.txt
Quoted 6 lines
Documentation/config/clone.txt +2
-2---bare:: +`--bare`:: Make a 'bare' Git repository. That is, instead of creating _<directory>_ and placing the administrative - files in `<directory>/.git`, make the _<directory>_ + files in _<directory>_`/.git`, make the _<directory>_
This should be __<directory>__{empty}/.git
Thanks. Apart from the small mistake and the misrendering of "[--[no-]", this looks really nice to me, both HTML and manpage. The source .txt files do get a bit messier, especially with the {empty} trickery, but ok. (I haven't been paying attention. Maybe this has been discussed before, and TBH I haven't even dug -- I don't mean to start another round of discussion.)
Martin
Re: [PATCH 4/4] doc: git-clone: apply new documentation guidelines
Quoted 24 lines · Martin Ågren
Documentation/git-clone.txt git-clone - Clone a repository into a new directory · line 20
Quoted 9 lines
+
git clone[--template={empty}__<template-directory>__]Documentation/git-clone.txt +8
-0+ [`-l`] [`-s`] [`--no-hardlinks`] [`-q`] [`-n`] [`--bare`] [`--mirror`] + [`-o` _<name>_] [`-b` _<name>_] [`-u` _<upload-pack>_] [`--reference` _<repository>_] + [`--dissociate`] [`--separate-git-dir` _<git-dir>_] + [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-tags`] + [`--recurse-submodules`[`=`{empty}__<pathspec>__]] [`--`[`no-`]`shallow-submodules`] + [`--`[`no-`]`remote-submodules`] [`--jobs` _<n>_] [`--sparse`] [`--`[`no-`]`reject-shallow`] + [`--filter=`{empty}__<filter-spec>__] [`--also-filter-submodules`]] [`--`] _<repository>_ + [_<directory>_]Don't ask me why, but I need this on top (whitespace-damaged)
(quoted diff) +0
-2- [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-tags`] - [`--recurse-submodules`[`=`{empty}__<pathspec>__]][
--[no-]shallow-submodules]
- [--[no-]remote-submodules] [--jobs_<n>_]
[--sparse] [--[no-]reject-shallow]
+ [--depth_<depth>_] [--[no-]{empty}single-branch]
[--no-tags]
+ [--recurse-submodules[={empty}__<pathspec>__]]
[--[no-]{empty}shallow-submodules]
+ [--[no-]{empty}remote-submodules] [--jobs_<n>_]
[--sparse] [--[no-]{empty}reject-shallow]
Quoted 4 lines
i.e., some sprinkling of "{empty}", to keep each of these "[--[no-]" from simply disappearing. This is with Asciidoctor 1.5.5, which is admittedly starting to get old, but still ok as per our INSTALL document.
The original from Jean-Noël was already bad enough with all these {empty}, but now this is even worse.
Quoted 8 lines
Documentation/git-clone.txt objects from the source repository into a pack in the cloned repository. · line 165
Quoted 6 lines
---bare::
+--bare::
Make a 'bare' Git repository. That is, instead of creating _<directory>_ and placing the administrativeDocumentation/git-clone.txt +1
-1- files in `<directory>/.git`, make the _<directory>_ + files in _<directory>_`/.git`, make the _<directory>_This should be __<directory>__{empty}
/.git
The worst part is that I am not sure if there is a pattern easily understandable by document writers to help them decide where to sprinkle these {empty} mark-ups. Of course, they are visually very distracting and made our documentation that used to be perfectly readable in the source form to something much less pleasant to read.
Can we make both the rendered output nicer while keeping the source still readable and easy to maintain?
Thanks.
Re: [PATCH 4/4] doc: git-clone: apply new documentation guidelines
Quoted 4 lines · On Tuesday, 26 March 2024 21:20:16 CET Junio C Hamano wrote:
Quoted 2 lines · Martin Ågren
Quoted 2 lines
+
git clone[--template={empty}__<template-directory>__]
+ [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [`--
mirror`]
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ [
-o_<name>_] [-b_<name>_] [-u_<upload-pack>_] [`--
reference` _<repository>_]
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ [`--dissociate`] [`--separate-git-dir` _<git-dir>_] + [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-
tags`]
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ [
--recurse-submodules[={empty}__<pathspec>__]] [--[`no-
]shallow-submodules`]
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ [
--[no-]remote-submodules] [--jobs_<n>_] [--sparse]
[--[no-]reject-shallow]
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ [
--filter={empty}__<filter-spec>__] [`--also-filter-
submodules]] [--`] _<repository>_
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
+ [_<directory>_]
Don't ask me why, but I need this on top (whitespace-damaged)
(quoted diff) +0
-2- [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-tags`] - [`--recurse-submodules`[`=`{empty}__<pathspec>__]][
--[no-]shallow-submodules]
- [--[no-]remote-submodules] [--jobs_<n>_]
[--sparse] [--[no-]reject-shallow]
+ [--depth_<depth>_] [--[no-]{empty}single-branch]
[--no-tags]
+ [--recurse-submodules[={empty}__<pathspec>__]]
[--[no-]{empty}shallow-submodules]
+ [--[no-]{empty}remote-submodules] [--jobs_<n>_]
[--sparse] [--[no-]{empty}reject-shallow]
Quoted 7 lines
Quoted 4 lines
i.e., some sprinkling of "{empty}", to keep each of these "[--[no-]" from simply disappearing. This is with Asciidoctor 1.5.5, which is admittedly starting to get old, but still ok as per our INSTALL document.
The original from Jean-Noël was already bad enough with all these {empty}, but now this is even worse.
I must concede this does not help make these parts readable in the source. The point that Martin raised is the worst for me: if the processing of this workaround is depend on the version of Asciidoc[tor], the way of writing this formatting for stuck parts in a compatible way must be clearly defined (and made understandable).
Quoted 16 lines
Quoted 9 lines
Documentation/git-clone.txt objects from the source repository into a pack in the cloned repository. · line 165
Quoted 7 lines
---bare::
+--bare::
Make a 'bare' Git repository. That is, instead of creating _<directory>_ and placing the administrativeDocumentation/git-clone.txt +1
-1- files in `<directory>/.git`, make the _<directory>_ + files in _<directory>_`/.git`, make the _<directory>_This should be __<directory>__{empty}
/.gitThe worst part is that I am not sure if there is a pattern easily understandable by document writers to help them decide where to sprinkle these {empty} mark-ups. Of course, they are visually very distracting and made our documentation that used to be perfectly readable in the source form to something much less pleasant to read.
Quoted 5 lines
Can we make both the rendered output nicer while keeping the source still readable and easy to maintain?
Thanks.
I came up with this trickery because of the use of "legacy" Asciidoc format, which does not understand unconstrained formatting (doubling the signs, so that they don't care about word boundary). With the new format, we would simply write:
__<directory>__``/.git``
``--filter=``__<filter-spec>__
Without having to pay attention to the surrounding characters.
For now, we are stuck with the compatibility with the existing tools. I will try an propose something else. Would preprocessing be accepted?
Re: [PATCH 4/4] doc: git-clone: apply new documentation guidelines
Quoted 2 lines · Jean-Noël AVILA
For now, we are stuck with the compatibility with the existing tools. I will try an propose something else. Would preprocessing be accepted?
Pre-processing will be hidden inside Documentation/Makefile and would be invisible to developers, so as long as it is cleanly and robustly done, that would be fine, I would say.
v2 cover Doc new guidelines
In reply to Jean-Noël Avila via GitGitGadgetThis version is a simplification of the markup. The behavior is variable, depending on versions of asciidoc[tor], but at least, it works both on my station and in github-ci. @Martin, please check on your platform.
Changes since v1:
* use unconstrained markup ++ for verbatim stuck to emphasis, instead of {empty} trickery
* document and apply markup on man page references
* split git-clone commit into markup and non-autoreference
Jean-Noël Avila (5):
doc: rework CodingGuidelines with new formatting rules
doc: allow literal and emphasis format in doc vs help tests
doc: git-init: apply new documentation formatting guidelines
doc: git-clone: apply new documentation formatting guidelines
doc: git-clone: do not autoreference the manpage in itself
Documentation/CodingGuidelines | 153 ++++++++++++++++++--------------- Documentation/config/clone.txt | 20 +++-- Documentation/config/init.txt | 4 +- Documentation/git-clone.txt | 120 +++++++++++++------------- Documentation/git-init.txt | 56 ++++++------ Documentation/urls.txt | 44 +++++----- t/t0450-txt-doc-vs-help.sh | 4 +- 7 files changed, 216 insertions(+), 185 deletions(-)
base-commit: 11c821f2f2a31e70fb5cc449f9a29401c333aad2
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1702%2Fjnavila%2Fdoc_new_Guidelines-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1702/jnavila/doc_new_Guidelines-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1702
Range-diff vs v1:
1: d08e8bfd9bc ! 1: 8a25ab1c3b6 doc: rework CodingGuidelines with new formatting rules
@@ Documentation/CodingGuidelines: Writing Documentation:
+ .git/config
+ GIT_DIR
+ HEAD
++ umask(2)
+
+ An environment variable must be prefixed with "$" only when referring to its
+ value and not when referring to the variable itself, in this case there is
@@ Documentation/CodingGuidelines: Writing Documentation:
+ _<key-id>_
+
+ When literal and placeholders are mixed, each markup is applied for
-+ each sub-entity. If they are stuck, a special markup, with an {empty} -+ entity is needed:
++ each sub-entity. If they are stuck, a special markup, called
++ unconstrained formatting is required.
++ Unconstrained formating for placeholders is __<like-this>__
++ Unconstrained formatting for literal formatting is ++like this++
+ --jobs _<n>_
-+ --sort={empty}__<key>__
-+ __<directory>__{empty}/.git
-+ remote.{empty}__<name>__{empty}.mirror
++ ++--sort=++__<key>__
++ __<directory>__++/.git++
++ ++remote.++__<name>__++.mirror++
+
-+Synopsis Syntax
++ caveat: ++ unconstrained format is not verbatim and may expand
++ content. Use Asciidoc escapes inside them.
- When a placeholder is cited in text paragraph, it is enclosed in angle
- brackets to remind the reader the reference in the synopsis section.
- For better visibility, the placeholder is typeset in italics:
- The _<file>_ to be added.
++Synopsis Syntax
++
+ Syntax grammar is formatted neither as literal nor as placeholder. +
+ A few commented examples follow to provide reference when writing or
@@ Documentation/CodingGuidelines: Writing Documentation:
(Zero or more of <file>.)
- --exec-path[=<path>]
-+ --exec-path[={empty}__<path>__]
++ ++--exec-path++[++=++__<path>__]
(Option with an optional argument. Note that the "=" is inside the brackets.)
@@ Documentation/CodingGuidelines: Writing Documentation:
alternate arguments of an option:
- Do: --track[=(direct|inherit)]
- Don't: --track[=(direct | inherit)]
-+ Do: --track[=(direct|inherit)]`
-+ Don't: --track[=(direct | inherit)]
++ Do: ++--track++[++=++(direct|inherit)]`
++ Don't: ++--track++[++=++(direct | inherit)]
Parentheses are used for grouping:
- [(<rev> | <range>)...]
2: 202ed891463 ! 2: 1a4feff2aea doc: allow literal and emphasis format in doc vs help tests
@@ t/t0450-txt-doc-vs-help.sh: txt_to_synopsis () {
/^$/d;
/^\[verse\]$/d;
-
-+ s/{empty}\|_\|`//g;
++ s/_//g;
++ s/++//g;
++ s/`//g;
s/{litdd}/--/g;
s/'\''\(git[ a-z-]*\)'\''/\1/g; 3: 310f09fc81c ! 3: ad7986e4c39 doc: git-init: apply new documentation formatting guidelines
@@ Documentation/git-init.txt: git-init - Create an empty Git repository or reiniti
- [--ref-format=<format>]
- [-b <branch-name> | --initial-branch=<branch-name>]
- [--shared[=<permissions>]] [<directory>]
-+`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>_]
DESCRIPTION
@@ Documentation/git-init.txt: the repository to another place if `--separate-git-d
current working directory.
---object-format=<format>::
-+`--object-format=`{empty}__<format>__::
++++--object-format=++__<format>__::
Specify the given object _<format>_ (hash algorithm) for the repository. The valid
values are `sha1` and (if enabled) `sha256`. `sha1` is the default.
@@ Documentation/git-init.txt: the repository to another place if `--separate-git-d
include::object-format-disclaimer.txt[]
---ref-format=<format>::
-+`--ref-format=`{empty}__<format>__::
++++--ref-format=++__<format>__::
Specify the given ref storage _<format>_ for the repository. The valid values are:
+
include::ref-storage-format.txt[]
---template=<template-directory>::
-+`--template=`{empty}__<template-directory>__::
++++--template=++__<template-directory>__::
Specify the directory from which templates will be used. (See the "TEMPLATE
DIRECTORY" section below.)
---separate-git-dir=<git-dir>::
-+`--separate-git-dir=`{empty}__<git-dir>__::
++++--separate-git-dir=++__<git-dir>__::
Instead of initializing the repository as a directory to either `$GIT_DIR` or
`./.git/`, create a text file there containing the path to the actual
@@ Documentation/git-init.txt: repository.
--b <branch-name>::
---initial-branch=<branch-name>::
+`-b` _<branch-name>_::
-+`--initial-branch=`{empty}__<branch-name>__::
++++--initial-branch=++__<branch-name>__::
Use _<branch-name>_ for the initial branch in the newly created
repository. If not specified, fall back to the default name (currently
@@ Documentation/git-init.txt: repository.
customized via the `init.defaultBranch` configuration variable).
---shared[=(false|true|umask|group|all|world|everybody|<perm>)]::
-+`--shared`[`=`(`false`|`true`|`umask`|`group`|`all`|`world`|`everybody`|_<perm>_)]::
++++--shared++[++=++(`false`|`true`|`umask`|`group`|`all`|`world`|`everybody`|_<perm>_)]::
Specify that the Git repository is to be shared amongst several users. This
allows users belonging to the same group to push into that
-@@ Documentation/git-init.txt: The option can have the following values, defaulting to `group` if no value
+ repository. When specified, the config variable `core.sharedRepository` is
+ set so that files and directories under `$GIT_DIR` are created with the
+ requested permissions. When not specified, Git will use permissions reported
+-by `umask(2)`.
++by `umask`(2).
+ +
+ The option can have the following values, defaulting to `group` if no value
is given:
+
--
@@ Documentation/git-init.txt: The option can have the following values, defaulting
+`umask`::
+`false`::
- Use permissions reported by umask(2). The default, when `--shared` is not
+-Use permissions reported by umask(2). The default, when `--shared` is not
++Use permissions reported by `umask`(2). The default, when `--shared` is not
specified.
-group::
@@ Documentation/git-init.txt: The option can have the following values, defaulting
+`group`::
+`true`::
- Make the repository group-writable, (and g+sx, since the git group may not be
+-Make the repository group-writable, (and g+sx, since the git group may not be
++Make the repository group-writable, (and `g+sx`, since the git group may not be
the primary group of all users). This is used to loosen the permissions of an
-@@ Documentation/git-init.txt: permission bits (e.g. if umask is `0022`, using `group` will not remove read
+-otherwise safe umask(2) value. Note that the umask still applies to the other
++otherwise safe `umask`(2) value. Note that the umask still applies to the other
+ permission bits (e.g. if umask is `0022`, using `group` will not remove read
privileges from other (non-group) users). See `0xxx` for how to exactly specify
the repository permissions.
@@ Documentation/git-init.txt: permission bits (e.g. if umask is `0022`, using `gro
+_<perm>_::
_<perm>_ is a 3-digit octal number prefixed with `0` and each file
- will have mode _<perm>_. _<perm>_ will override users'`umask(2)`
+-will have mode _<perm>_. _<perm>_ will override users'`umask(2)`
++will have mode _<perm>_. _<perm>_ will override users' `umask`(2)
+ value (and not only loosen permissions as `group` and `all`
+ do). `0640` will create a repository which is group-readable, but
+ not group-writable or accessible to others. `0660` will create a repo
4: 5ae83d3f799 ! 4: 54c2012429d doc: git-clone: apply new documentation guidelines
@@ Metadata
Author: Jean-Noël Avila <[email protected]>
## Commit message ##
- doc: git-clone: apply new documentation guidelines
-
- Heavily apply literal and placeholder markup everywhere.
+ doc: git-clone: apply new documentation formatting guidelines
Signed-off-by: Jean-Noël Avila <[email protected]>
@@ Documentation/config/clone.txt
-clone.defaultRemoteName::
+`clone.defaultRemoteName`::
The name of the remote to create when cloning a repository. Defaults to
-- `origin`, and can be overridden by passing the `--origin` command-line
-+ `origin`.
-+ifdef::git-clone[]
-+ It can be overridden by passing the `--origin` command-line
-+ option.
-+endif::[]
-+ifndef::git-clone[]
-+ It can be overridden by passing the `--origin` command-line
+ `origin`, and can be overridden by passing the `--origin` command-line
option to linkgit:git-clone[1].
-+endif::[]
-+`clone.rejectShallow`::
-+ Reject cloning a repository if it is a shallow one. This can be overridden by
-+ passing the `--reject-shallow` option on the command line.
-+ifndef::git-clone[]
-+ See linkgit:git-clone[1]
-+endif::[]
-clone.rejectShallow::
-- Reject cloning a repository if it is a shallow one; this can be overridden by
-- passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1]
--
++`clone.rejectShallow`::
+ Reject cloning a repository if it is a shallow one; this can be overridden by
+ passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1]
+
-clone.filterSubmodules::
+`clone.filterSubmodules`::
If a partial clone filter is provided (see `--filter` in
@@ Documentation/git-clone.txt: git-clone - Clone a repository into a new directory
- [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow]
- [--filter=<filter> [--also-filter-submodules]] [--] <repository>
- [<directory>]
-+`git clone` [`--template=`{empty}__<template-directory>__]
++`git clone` [++--template=++__<template-directory>__]
+ [`-l`] [`-s`] [`--no-hardlinks`] [`-q`] [`-n`] [`--bare`] [`--mirror`]
+ [`-o` _<name>_] [`-b` _<name>_] [`-u` _<upload-pack>_] [`--reference` _<repository>_]
+ [`--dissociate`] [`--separate-git-dir` _<git-dir>_]
+ [`--depth` _<depth>_] [`--`[`no-`]`single-branch`] [`--no-tags`]
-+ [`--recurse-submodules`[`=`{empty}__<pathspec>__]] [`--`[`no-`]`shallow-submodules`]
++ [++--recurse-submodules++[++=++__<pathspec>__]] [`--`[`no-`]`shallow-submodules`]
+ [`--`[`no-`]`remote-submodules`] [`--jobs` _<n>_] [`--sparse`] [`--`[`no-`]`reject-shallow`]
-+ [`--filter=`{empty}__<filter-spec>__] [`--also-filter-submodules`]] [`--`] _<repository>_
++ [++--filter=++__<filter-spec>__] [`--also-filter-submodules`]] [`--`] _<repository>_
+ [_<directory>_]
DESCRIPTION
@@ Documentation/git-clone.txt: objects from the source repository into a pack in t
standard error stream is not directed to a terminal.
---server-option=<option>::
-+`--server-option=`{empty}__<option>__::
++++--server-option=++__<option>__::
Transmit the given string to the server when communicating using
protocol version 2. The given string must not contain a NUL or LF
character. The server's handling of server options, including
unknown ones, is server-specific.
- When multiple `--server-option=<option>` are given, they are all
-+ When multiple `--server-option=`{empty}__<option>__ are given, they are all
++ When multiple ++--server-option=++__<option>__ are given, they are all
sent to the other side in the order listed on the command line.
--n::
@@ Documentation/git-clone.txt: objects from the source repository into a pack in t
working directory as needed.
---filter=<filter-spec>::
-+`--filter=`{empty}__<filter-spec>__::
++++--filter=++__<filter-spec>__::
Use the partial clone feature and request that the server sends
a subset of reachable objects according to a given object filter.
When using `--filter`, the supplied _<filter-spec>_ is used for
the partial clone filter. For example, `--filter=blob:none` will
filter out all blobs (file contents) until needed by Git. Also,
- `--filter=blob:limit=<size>` will filter out all blobs of size
-+ `--filter=blob:limit=`{empty}__<size>__ will filter out all blobs of size
++ ++--filter=blob:limit=++__<size>__ will filter out all blobs of size
at least _<size>_. For more details on filter specifications, see
the `--filter` option in linkgit:git-rev-list[1].
@@ Documentation/git-clone.txt: objects from the source repository into a pack in t
run on the other end.
---template=<template-directory>::
-+`--template=`{empty}__<template-directory>__::
++++--template=++__<template-directory>__::
Specify the directory from which templates will be used;
(See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
--c <key>=<value>::
---config <key>=<value>::
-+`-c` __<key>__{empty}`=`{empty}__<value>__::
-+`--config` __<key>__{empty}`=`{empty}__<value>__::
++`-c` __<key>__++=++__<value>__::
++`--config` __<key>__++=++__<value>__::
Set a configuration variable in the newly-created repository;
this takes effect immediately after the repository is
initialized, but before the remote history is fetched or any
@@ Documentation/git-clone.txt: objects from the source repository into a pack in t
variables do not take effect until after the initial fetch and checkout.
Configuration variables known to not take effect are:
-`remote.<name>.mirror` and `remote.<name>.tagOpt`. Use the
-+`remote.`{empty}__<name>__{empty}`.mirror` and `remote.`{empty}__<name>__{empty}`.tagOpt`. Use the
++++remote.++__<name>__++.mirror++ and ++remote.++__<name>__++.tagOpt++. Use the
corresponding `--mirror` and `--no-tags` options instead.
---depth <depth>::
@@ Documentation/git-clone.txt: objects from the source repository into a pack in t
also pass `--shallow-submodules`.
---shallow-since=<date>::
-+`--shallow-since=`{empty}__<date>__::
++++--shallow-since=++__<date>__::
Create a shallow clone with a history after the specified time.
---shallow-exclude=<revision>::
-+`--shallow-exclude=`{empty}__<revision>__::
++++--shallow-exclude=++__<revision>__::
Create a shallow clone with a history, excluding commits
reachable from a specified remote branch or tag. This option
can be specified multiple times.
@@ Documentation/git-clone.txt: the clone is finished. This option is ignored if th
in the bundle will be stored under the hidden `refs/bundle/*`
## Documentation/urls.txt ##
+@@ Documentation/urls.txt: should be used with caution on unsecured networks.
+
+ The following syntaxes may be used with them:
+
+-- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
+-- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
+-- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
+-- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
++- ++ssh://++{startsb}__<user>__++@++{endsb}__<host>__{startsb}++:++__<port>__{endsb}++/++__<path-to-git-repo>__
++- ++git://++__<host>__{startsb}:__<port>__{endsb}++/++__<path-to-git-repo>__
++- ++http++{startsb}++s++{endsb}++://++__<host>__{startsb}++:++__<port>__{endsb}++/++__<path-to-git-repo>__
++- ++ftp++{startsb}++s++{endsb}++://++__<host>__{startsb}++:++__<port>__{endsb}++/++__<path-to-git-repo>__
+
+ An alternative scp-like syntax may also be used with the ssh protocol:
+
+-- {startsb}user@{endsb}host.xz:path/to/repo.git/
++- {startsb}__<user>__++@++{endsb}__<host>__++:/++__<path-to-git-repo>__
+
+ This syntax is only recognized if there are no slashes before the
+ first colon. This helps differentiate a local path that contains a
+@@ Documentation/urls.txt: colon. For example the local path `foo:bar` could be specified as an
+ absolute path or `./foo:bar` to avoid being misinterpreted as an ssh
+ url.
+
+-The ssh and git protocols additionally support ~username expansion:
++The ssh and git protocols additionally support ++~++__<username>__ expansion:
+
+-- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
+-- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
+-- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/
++- ++ssh://++{startsb}__<user>__++@++{endsb}__<host>__{startsb}++:++__<port>__{endsb}++/~++__<user>__++/++__<path-to-git-repo>__
++- ++git://++__<host>__{startsb}++:++__<port>__{endsb}++/~++__<user>__++/++__<path-to-git-repo>__
++- {startsb}__<user>__++@++{endsb}__<host>__++:~++__<user>__++/++__<path-to-git-repo>__
+
+ For local repositories, also supported by Git natively, the following
+ syntaxes may be used:
+
+-- /path/to/repo.git/
+-- \file:///path/to/repo.git/
++- `/path/to/repo.git/`
++- ++file:///path/to/repo.git/++
+
+ ifndef::git-clone[]
+ These two syntaxes are mostly equivalent, except when cloning, when
@@ Documentation/urls.txt: endif::git-clone[]
accept a suitable bundle file. See linkgit:git-bundle[1]. -: ----------- > 5: 38bd78c92eb doc: git-clone: do not autoreference the manpage in itself
Signature · 1 line
gitgitgadget
PATCH v2 1/5 doc: rework CodingGuidelines with new formatting rules
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
Literal and placeholder formatting is more heavily enforced, with some asciidoc magic. Basically, the markup is preserved everywhere.
--- Documentation/CodingGuidelines | 153 ++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 68 deletions(-)
Documentation/CodingGuidelines +85 -68
@@ -641,15 +641,15 @@ Writing Documentation: - Prefer succinctness and matter-of-factly describing functionality in the abstract. E.g. - --short:: Emit output in the short-format. + `--short`:: Emit output in the short-format. and avoid something like these overly verbose alternatives: - --short:: Use this to emit output in the short-format. - --short:: You can use this to get output in the short-format. - --short:: A user who prefers shorter output could.... - --short:: Should a person and/or program want shorter output, he - she/they/it can... + `--short`:: Use this to emit output in the short-format. + `--short`:: You can use this to get output in the short-format. + `--short`:: A user who prefers shorter output could.... + `--short`:: Should a person and/or program want shorter output, he + she/they/it can... This practice often eliminates the need to involve human actors in your description, but it is a good practice regardless of the
@@ -659,12 +659,12 @@ Writing Documentation: addressing the hypothetical user, and possibly "we" when discussing how the program might react to the user. E.g. - You can use this option instead of --xyz, but we might remove + You can use this option instead of `--xyz`, but we might remove support for it in future versions. while keeping in mind that you can probably be less verbose, e.g. - Use this instead of --xyz. This option might be removed in future + Use this instead of `--xyz`. This option might be removed in future versions. - If you still need to refer to an example person that is
@@ -682,68 +682,118 @@ Writing Documentation: The same general rule as for code applies -- imitate the existing conventions. - A few commented examples follow to provide reference when writing or - modifying command usage strings and synopsis sections in the manual - pages: - Placeholders are spelled in lowercase and enclosed in angle brackets: - <file> - --sort=<key> - --abbrev[=<n>] +Markup: + + Literal parts (e.g. use of command-line options, command names, + branch names, URLs, pathnames (files and directories), configuration and + environment variables) must be typeset as verbatim (i.e. wrapped with + backticks): + `--pretty=oneline` + `git rev-list` + `remote.pushDefault` + `http://git.example.com` + `.git/config` + `GIT_DIR` + `HEAD` + `umask`(2) + + An environment variable must be prefixed with "$" only when referring to its + value and not when referring to the variable itself, in this case there is + nothing to add except the backticks: + `GIT_DIR` is specified + `$GIT_DIR/hooks/pre-receive` + + Word phrases enclosed in `backtick characters` are rendered literally + and will not be further expanded. The use of `backticks` to achieve the + previous rule means that literal examples should not use AsciiDoc + escapes. + Correct: + `--pretty=oneline` + Incorrect: + `\--pretty=oneline` + + Placeholders are spelled in lowercase and enclosed in + angle brackets surrounded by underscores: + _<file>_ + _<commit>_ If a placeholder has multiple words, they are separated by dashes: - <new-branch-name> - --template=<template-directory> + _<new-branch-name>_ + _<template-directory>_ + + A placeholder is not enclosed in backticks, as it is not a literal. + + When needed, use a distinctive identifier for placeholders, usually + made of a qualification and a type: + _<git-dir>_ + _<key-id>_ + + When literal and placeholders are mixed, each markup is applied for + each sub-entity. If they are stuck, a special markup, called + unconstrained formatting is required. + Unconstrained formating for placeholders is __<like-this>__ + Unconstrained formatting for literal formatting is ++like this++ + `--jobs` _<n>_ + ++--sort=++__<key>__ + __<directory>__++/.git++ + ++remote.++__<name>__++.mirror++ + + caveat: ++ unconstrained format is not verbatim and may expand + content. Use Asciidoc escapes inside them. - When a placeholder is cited in text paragraph, it is enclosed in angle - brackets to remind the reader the reference in the synopsis section. - For better visibility, the placeholder is typeset in italics: - The _<file>_ to be added. +Synopsis Syntax + + Syntax grammar is formatted neither as literal nor as placeholder. + + A few commented examples follow to provide reference when writing or + modifying command usage strings and synopsis sections in the manual + pages: Possibility of multiple occurrences is indicated by three dots: - <file>... + _<file>_... (One or more of <file>.) Optional parts are enclosed in square brackets: - [<file>...] + [_<file>_...] (Zero or more of <file>.) - --exec-path[=<path>] + ++--exec-path++[++=++__<path>__] (Option with an optional argument. Note that the "=" is inside the brackets.) - [<patch>...] + [_<patch>_...] (Zero or more of <patch>. Note that the dots are inside, not outside the brackets.) Multiple alternatives are indicated with vertical bars: - [-q | --quiet] - [--utf8 | --no-utf8] + [`-q` | `--quiet`] + [`--utf8` | `--no-utf8`] Use spacing around "|" token(s), but not immediately after opening or before closing a [] or () pair: - Do: [-q | --quiet] - Don't: [-q|--quiet] + Do: [`-q` | `--quiet`] + Don't: [`-q`|`--quiet`] Don't use spacing around "|" tokens when they're used to separate the alternate arguments of an option: - Do: --track[=(direct|inherit)] - Don't: --track[=(direct | inherit)] + Do: ++--track++[++=++(`direct`|`inherit`)]` + Don't: ++--track++[++=++(`direct` | `inherit`)] Parentheses are used for grouping: - [(<rev> | <range>)...] + [(_<rev>_ | _<range>_)...] (Any number of either <rev> or <range>. Parens are needed to make it clear that "..." pertains to both <rev> and <range>.) - [(-p <parent>)...] + [(`-p` _<parent>_)...] (Any number of option -p, each with one <parent> argument.) - git remote set-head <name> (-a | -d | <branch>) + `git remote set-head` _<name>_ (`-a` | `-d` | _<branch>_) (One and only one of "-a", "-d" or "<branch>" _must_ (no square brackets) be provided.) And a somewhat more contrived example: - --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] + `--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]` Here "=" is outside the brackets, because "--diff-filter=" is a valid usage. "*" has its own pair of brackets, because it can (optionally) be specified only when one or more of the letters is
@@ -754,39 +804,6 @@ Writing Documentation: the user would type into a shell and use 'Git' (uppercase first letter) when talking about the version control system and its properties. - A few commented examples follow to provide reference when writing or - modifying paragraphs or option/command explanations that contain options - or commands: - - Literal examples (e.g. use of command-line options, command names, - branch names, URLs, pathnames (files and directories), configuration and - environment variables) must be typeset in monospace (i.e. wrapped with - backticks): - `--pretty=oneline` - `git rev-list` - `remote.pushDefault` - `http://git.example.com` - `.git/config` - `GIT_DIR` - `HEAD` - - An environment variable must be prefixed with "$" only when referring to its - value and not when referring to the variable itself, in this case there is - nothing to add except the backticks: - `GIT_DIR` is specified - `$GIT_DIR/hooks/pre-receive` - - Word phrases enclosed in `backtick characters` are rendered literally - and will not be further expanded. The use of `backticks` to achieve the - previous rule means that literal examples should not use AsciiDoc - escapes. - Correct: - `--pretty=oneline` - Incorrect: - `\--pretty=oneline` - -A placeholder is not enclosed in backticks, as it is not a literal. - If some place in the documentation needs to typeset a command usage example with inline substitutions, it is fine to use +monospaced and inline substituted text+ instead of `monospaced literal text`, and with
Signature · 1 line
gitgitgadget
Re: [PATCH v2 1/5] doc: rework CodingGuidelines with new formatting rules
Documentation/CodingGuidelines Writing Documentation: · line 684
Quoted 12 lines · Jean-Noël Avila via GitGitGadget
Literal and placeholder formatting is more heavily enforced, with some asciidoc magic. Basically, the markup is preserved everywhere.
Signed-off-by Jean-Noël Avila <[email protected]>---
Documentation/CodingGuidelines +2
-2@@ -682,68 +682,118 @@ Writing Documentation: If a placeholder has multiple words, they are separated by dashes: - <new-branch-name> - --template=<template-directory> + _<new-branch-name>_ + _<template-directory>_
Having two separate examples made sense in the original because it was illustrating a standalone placeholder versus a placeholder coupled with some literal text ("--template="). However, in the revised hunk, there is no reason to use both "_<new-branch-name>_" and "_<template-directory>_" as examples; the reader does not learn anything new from the second example which couldn't be learned from the first. As such, I'd drop the latter example.
Re: [PATCH v2 1/5] doc: rework CodingGuidelines with new formatting rules
Quoted 8 lines · On Friday, 29 March 2024 19:42:28 CET Eric Sunshine wrote:
Documentation/
Quoted 6 lines · Jean-Noël Avila via GitGitGadget
Literal and placeholder formatting is more heavily enforced, with some asciidoc magic. Basically, the markup is preserved everywhere.
Signed-off-by Jean-Noël Avila <[email protected]>---
Documentation/ renamed from Documentation/CodingGuidelines +0
-0
CodingGuidelines
Quoted 7 lines
Documentation/ Writing Documentation: · line 684
Quoted 6 lines
Documentation/ renamed from Documentation/CodingGuidelines +2
-2@@ -682,68 +682,118 @@ Writing Documentation: If a placeholder has multiple words, they are separated by dashes: - <new-branch-name> - --template=<template-directory> + _<new-branch-name>_ + _<template-directory>_
Quoted 8 lines
Having two separate examples made sense in the original because it was illustrating a standalone placeholder versus a placeholder coupled with some literal text ("--template="). However, in the revised hunk, there is no reason to use both "_<new-branch-name>_" and "_<template-directory>_" as examples; the reader does not learn anything new from the second example which couldn't be learned from the first. As such, I'd drop the latter example.
A few examples don't hurt. Anyway, if I have to reroll a v3, I'll remove _<template-directory>_ which would be better located in the next paragraph.
PATCH v2 2/5 doc: allow literal and emphasis format in doc vs help tests
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
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.
--- t/t0450-txt-doc-vs-help.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
t/t0450-txt-doc-vs-help.sh +3 -1
@@ -59,7 +59,9 @@ txt_to_synopsis () { -e '/^\[verse\]$/,/^$/ { /^$/d; /^\[verse\]$/d; - + s/_//g; + s/++//g; + s/`//g; s/{litdd}/--/g; s/'\''\(git[ a-z-]*\)'\''/\1/g;
Signature · 1 line
gitgitgadget
PATCH v2 3/5 doc: git-init: apply new documentation formatting guidelines
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
--- Documentation/config/init.txt | 4 +-- Documentation/git-init.txt | 56 +++++++++++++++++------------------ 2 files changed, 30 insertions(+), 30 deletions(-)
Documentation/config/init.txt +2 -2
@@ -3,8 +3,8 @@ ifndef::git-init[] :see-git-init: (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].) endif::[] -init.templateDir:: +`init.templateDir`:: Specify the directory from which templates will be copied. {see-git-init} -init.defaultBranch:: +`init.defaultBranch`:: Allows overriding the default branch name e.g. when initializing a new repository.
Documentation/git-init.txt +28 -28
127 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 4/5 doc: git-clone: apply new documentation formatting guidelines
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
--- Documentation/config/clone.txt | 6 +- Documentation/git-clone.txt | 120 ++++++++++++++++----------------- Documentation/urls.txt | 44 ++++++------ 3 files changed, 86 insertions(+), 84 deletions(-)
Documentation/config/clone.txt +3 -3
@@ -1,13 +1,13 @@ -clone.defaultRemoteName:: +`clone.defaultRemoteName`:: The name of the remote to create when cloning a repository. Defaults to `origin`, and can be overridden by passing the `--origin` command-line option to linkgit:git-clone[1]. -clone.rejectShallow:: +`clone.rejectShallow`:: Reject cloning a repository if it is a shallow one; this can be overridden by passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1] -clone.filterSubmodules:: +`clone.filterSubmodules`:: If a partial clone filter is provided (see `--filter` in linkgit:git-rev-list[1]) and `--recurse-submodules` is used, also apply the filter to submodules.
Documentation/git-clone.txt +60 -60
310 lines not on this page · raw message
Documentation/urls.txt +23 -21
85 lines not on this page · raw message
Signature · 1 line
gitgitgadget
PATCH v2 5/5 doc: git-clone: do not autoreference the manpage in itself
In reply to Jean-Noël Avila via GitGitGadgetFrom: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <[email protected]>
Auto-reference in man pages is a confusion factor.
--- Documentation/config/clone.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
Documentation/config/clone.txt +12 -2
@@ -1,11 +1,21 @@ `clone.defaultRemoteName`:: The name of the remote to create when cloning a repository. Defaults to - `origin`, and can be overridden by passing the `--origin` command-line + `origin`. +ifdef::git-clone[] + It can be overridden by passing the `--origin` command-line + option. +endif::[] +ifndef::git-clone[] + It can be overridden by passing the `--origin` command-line option to linkgit:git-clone[1]. +endif::[] `clone.rejectShallow`:: Reject cloning a repository if it is a shallow one; this can be overridden by - passing the `--reject-shallow` option on the command line. See linkgit:git-clone[1] + passing the `--reject-shallow` option on the command line. +ifndef::git-clone[] + See linkgit:git-clone[1]. +endif::[] `clone.filterSubmodules`:: If a partial clone filter is provided (see `--filter` in
Signature · 1 line
gitgitgadget