* [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format @ 2025-03-30 17:15 Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 1/5] doc: convert git-reset " Jean-Noël Avila via GitGitGadget ` (5 more replies) 0 siblings, 6 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:15 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila * Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace * Use instead of in the description * Use backticks for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Jean-Noël Avila (5): doc: convert git-reset to new documentation format doc: fix synopsis analysis logic doc: convert git-rm to new documentation format doc: move synopsis git-mv commands in the synopsis section doc: convert git-mv to new documentation format Documentation/asciidoc.conf.in | 8 +- Documentation/asciidoctor-extensions.rb.in | 6 +- Documentation/git-mv.adoc | 33 ++++--- Documentation/git-reset.adoc | 100 ++++++++++----------- Documentation/git-rm.adoc | 56 ++++++------ builtin/mv.c | 3 +- 6 files changed, 103 insertions(+), 103 deletions(-) base-commit: 66b90d9bad8476f6f3d71f5add5cf78809a998ed Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1896%2Fjnavila%2Fdoc_git_reset-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1896/jnavila/doc_git_reset-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1896 -- gitgitgadget ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/5] doc: convert git-reset to new documentation format 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 ` Jean-Noël Avila via GitGitGadget 2025-04-04 16:39 ` Martin Ågren 2025-03-30 17:16 ` [PATCH 2/5] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget ` (4 subsequent siblings) 5 siblings, 1 reply; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-reset.adoc | 100 +++++++++++++++++------------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Documentation/git-reset.adoc b/Documentation/git-reset.adoc index 79ad5643eed..5c73448e072 100644 --- a/Documentation/git-reset.adoc +++ b/Documentation/git-reset.adoc @@ -7,23 +7,23 @@ git-reset - Reset current HEAD to the specified state SYNOPSIS -------- -[verse] -'git reset' [-q] [<tree-ish>] [--] <pathspec>... -'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] -'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...] -'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] +[synopsis] +git reset [-q] [<tree-ish>] [--] <pathspec>... +git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] +git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...] +git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] DESCRIPTION ----------- -In the first three forms, copy entries from `<tree-ish>` to the index. -In the last form, set the current branch head (`HEAD`) to `<commit>`, +In the first three forms, copy entries from _<tree-ish>_ to the index. +In the last form, set the current branch head (`HEAD`) to _<commit>_, optionally modifying index and working tree to match. -The `<tree-ish>`/`<commit>` defaults to `HEAD` in all forms. +The _<tree-ish>_/_<commit>_ defaults to `HEAD` in all forms. -'git reset' [-q] [<tree-ish>] [--] <pathspec>...:: -'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]:: +`git reset [-q] [<tree-ish>] [--] <pathspec>...`:: +`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`:: These forms reset the index entries for all paths that match the - `<pathspec>` to their state at `<tree-ish>`. (It does not affect + _<pathspec>_ to their state at _<tree-ish>_. (It does not affect the working tree or the current branch.) + This means that `git reset <pathspec>` is the opposite of `git add @@ -37,30 +37,30 @@ and specifying a commit with `--source`, you can copy the contents of a path out of a commit to the index and to the working tree in one go. -'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...]:: +`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`:: Interactively select hunks in the difference between the index - and `<tree-ish>` (defaults to `HEAD`). The chosen hunks are applied + and _<tree-ish>_ (defaults to `HEAD`). The chosen hunks are applied in reverse to the index. + This means that `git reset -p` is the opposite of `git add -p`, i.e. -you can use it to selectively reset hunks. See the ``Interactive Mode'' +you can use it to selectively reset hunks. See the "Interactive Mode" section of linkgit:git-add[1] to learn how to operate the `--patch` mode. -'git reset' [<mode>] [<commit>]:: - This form resets the current branch head to `<commit>` and - possibly updates the index (resetting it to the tree of `<commit>`) and - the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD` - is set to the tip of the current branch. If `<mode>` is omitted, - defaults to `--mixed`. The `<mode>` must be one of the following: +`git reset [<mode>] [<commit>]`:: + This form resets the current branch head to _<commit>_ and + possibly updates the index (resetting it to the tree of _<commit>_) and + the working tree depending on _<mode>_. Before the operation, `ORIG_HEAD` + is set to the tip of the current branch. If _<mode>_ is omitted, + defaults to `--mixed`. The _<mode>_ must be one of the following: + -- ---soft:: +`--soft`:: Does not touch the index file or the working tree at all (but - resets the head to `<commit>`, just like all modes do). This leaves - all your changed files "Changes to be committed", as `git status` + resets the head to _<commit>_, just like all modes do). This leaves + all your changed files "Changes to be committed", as `git status would put it. ---mixed:: +`--mixed`:: Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action. @@ -68,33 +68,33 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode. If `-N` is specified, removed paths are marked as intent-to-add (see linkgit:git-add[1]). ---hard:: +`--hard`:: Resets the index and working tree. Any changes to tracked files in the - working tree since `<commit>` are discarded. Any untracked files or + working tree since _<commit>_ are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted. ---merge:: +`--merge`:: Resets the index and updates the files in the working tree that are - different between `<commit>` and `HEAD`, but keeps those which are + different between _<commit>_ and `HEAD`, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). - If a file that is different between `<commit>` and the index has + If a file that is different between _<commit>_ and the index has unstaged changes, reset is aborted. + In other words, `--merge` does something like a `git read-tree -u -m <commit>`, but carries forward unmerged index entries. ---keep:: +`--keep`:: Resets index entries and updates files in the working tree that are - different between `<commit>` and `HEAD`. - If a file that is different between `<commit>` and `HEAD` has local + different between _<commit>_ and `HEAD`. + If a file that is different between _<commit>_ and `HEAD` has local changes, reset is aborted. ---[no-]recurse-submodules:: - When the working tree is updated, using --recurse-submodules will +`--[no-]recurse-submodules`:: + When the working tree is updated, using `--recurse-submodules` will also recursively reset the working tree of all active submodules according to the commit recorded in the superproject, also setting - the submodules' HEAD to be detached at that commit. + the submodules' `HEAD` to be detached at that commit. -- See "Reset, restore and revert" in linkgit:git[1] for the differences @@ -104,31 +104,31 @@ between the three commands. OPTIONS ------- --q:: ---quiet:: +`-q`:: +`--quiet`:: Be quiet, only report errors. ---refresh:: ---no-refresh:: +`--refresh`:: +`--no-refresh`:: Refresh the index after a mixed reset. Enabled by default. ---pathspec-from-file=<file>:: - Pathspec is passed in `<file>` instead of commandline args. If - `<file>` is exactly `-` then standard input is used. Pathspec - elements are separated by LF or CR/LF. Pathspec elements can be +`--pathspec-from-file=<file>`:: + Pathspec is passed in _<file>_ instead of commandline args. If + _<file>_ is exactly `-` then standard input is used. Pathspec + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). See also `--pathspec-file-nul` and global `--literal-pathspecs`. ---pathspec-file-nul:: +`--pathspec-file-nul`:: Only meaningful with `--pathspec-from-file`. Pathspec elements are - separated with NUL character and all other characters are taken + separated with _NUL_ character and all other characters are taken literally (including newlines and quotes). -\--:: +`--`:: Do not interpret any more arguments as options. -<pathspec>...:: +`<pathspec>...`:: Limits the paths affected by the operation. + For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. @@ -348,7 +348,7 @@ $ git commit ... <8> ------------ + <1> First, reset the history back one commit so that we remove the original - commit, but leave the working tree with all the changes. The -N ensures + commit, but leave the working tree with all the changes. The `-N` ensures that any new files added with `HEAD` are still marked so that `git add -p` will find them. <2> Next, we interactively select diff hunks to add using the `git add -p` @@ -458,7 +458,7 @@ working index HEAD target working index HEAD --keep B C C .... -`reset --merge` is meant to be used when resetting out of a conflicted +`git reset --merge` is meant to be used when resetting out of a conflicted merge. Any mergy operation guarantees that the working tree file that is involved in the merge does not have a local change with respect to the index before it starts, and that it writes the result out to the working tree. So if @@ -467,7 +467,7 @@ between the index and the working tree, then it means that we are not resetting out from a state that a mergy operation left after failing with a conflict. That is why we disallow `--merge` option in this case. -`reset --keep` is meant to be used when removing some of the last +`git reset --keep` is meant to be used when removing some of the last commits in the current branch while keeping changes in the working tree. If there could be conflicts between the changes in the commit we want to remove and the changes in the working tree we want to keep, -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/5] doc: convert git-reset to new documentation format 2025-03-30 17:16 ` [PATCH 1/5] doc: convert git-reset " Jean-Noël Avila via GitGitGadget @ 2025-04-04 16:39 ` Martin Ågren 0 siblings, 0 replies; 19+ messages in thread From: Martin Ågren @ 2025-04-04 16:39 UTC (permalink / raw) To: Jean-Noël Avila via GitGitGadget; +Cc: git, Jean-Noël Avila Hi Jean-Noël, On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget <gitgitgadget@gmail.com> wrote: > - Switch the synopsis to a synopsis block which will automatically > format placeholders in italics and keywords in monospace > - Use _<placeholder>_ instead of <placeholder> in the description > - Use `backticks` for keywords and more complex option > descriptions. The new rendering engine will apply synopsis rules to > these spans. > ---soft:: > +`--soft`:: > Does not touch the index file or the working tree at all (but > - resets the head to `<commit>`, just like all modes do). This leaves > - all your changed files "Changes to be committed", as `git status` > + resets the head to _<commit>_, just like all modes do). This leaves > + all your changed files "Changes to be committed", as `git status > would put it. This loses the closing backtick after "git status". > ---pathspec-from-file=<file>:: > - Pathspec is passed in `<file>` instead of commandline args. If > - `<file>` is exactly `-` then standard input is used. Pathspec > - elements are separated by LF or CR/LF. Pathspec elements can be > +`--pathspec-from-file=<file>`:: > + Pathspec is passed in _<file>_ instead of commandline args. If > + _<file>_ is exactly `-` then standard input is used. Pathspec > + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be > quoted as explained for the configuration variable `core.quotePath` > (see linkgit:git-config[1]). See also `--pathspec-file-nul` and > global `--literal-pathspecs`. > > ---pathspec-file-nul:: > +`--pathspec-file-nul`:: > Only meaningful with `--pathspec-from-file`. Pathspec elements are > - separated with NUL character and all other characters are taken > + separated with _NUL_ character and all other characters are taken > literally (including newlines and quotes). I was surprised that you wrapped CR, LF, and NUL in underscores. The commit message only talks about <placeholders>, similar to CodingGuidelines. That said, these _CR_ and friends seem to be consistent with similar conversions you've done before. Martin ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/5] doc: fix synopsis analysis logic 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 1/5] doc: convert git-reset " Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 ` Jean-Noël Avila via GitGitGadget 2025-04-04 16:39 ` Martin Ågren 2025-03-30 17:16 ` [PATCH 3/5] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget ` (3 subsequent siblings) 5 siblings, 1 reply; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> The synopsis analysis logic was not able to handle backslashes and stars which are used in the synopsis of the git-rm command. This patch fixes the issue by updating the regular expression used to match the keywords. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/asciidoc.conf.in | 8 ++++---- Documentation/asciidoctor-extensions.rb.in | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/asciidoc.conf.in b/Documentation/asciidoc.conf.in index f2aef6cb79f..50f0e81a831 100644 --- a/Documentation/asciidoc.conf.in +++ b/Documentation/asciidoc.conf.in @@ -43,7 +43,7 @@ ifdef::doctype-book[] endif::doctype-book[] [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-docbook[] @@ -75,18 +75,18 @@ git-relative-html-prefix= <a href="{git-relative-html-prefix}{target}.html">{target}{0?({0})}</a> [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<em>\1</em>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<code>\2</code>', re.sub(r'(\.\.\.?)([^\]$.])', r'<code>\1</code>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<em>\1</em>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<code>\2</code>', re.sub(r'(\.\.\.?)([^\]$.])', r'<code>\1</code>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-xhtml11[] ifdef::backend-docbook[] ifdef::doctype-manpage[] [paradef-default] -synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<phrase>\\0</phrase>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<literal>\\2</literal>!g;s!<[-a-zA-Z0-9.]\\+>!<emphasis>\\0</emphasis>!g'" +synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<phrase>\\0</phrase>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.\\\\\\*]\\+\\|…\\)!\\1<literal>\\2</literal>!g;s!<[-a-zA-Z0-9.]\\+>!<emphasis>\\0</emphasis>!g'" endif::doctype-manpage[] endif::backend-docbook[] ifdef::backend-xhtml11[] [paradef-default] -synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<span>\\0</span>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<code>\\2</code>!g;s!<[-a-zA-Z0-9.]\\+>!<em>\\0</em>!g'" +synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<span>\\0</span>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.\\\\\\*]\\+\\|…\\)!\\1<code>\\2</code>!g;s!<[-a-zA-Z0-9.]\\+>!<em>\\0</em>!g'" endif::backend-xhtml11[] diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index 2494f17a514..09156b71a4f 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -50,7 +50,7 @@ module Git def process parent, reader, attrs outlines = reader.lines.map do |l| l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') - .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') + .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}') .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') .gsub(']', ']{empty}') end @@ -72,7 +72,7 @@ module Git %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) elsif type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') else open, close, supports_phrase = QUOTE_TAGS[type] @@ -100,7 +100,7 @@ module Git def convert_inline_quoted node if node.type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') else -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/5] doc: fix synopsis analysis logic 2025-03-30 17:16 ` [PATCH 2/5] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget @ 2025-04-04 16:39 ` Martin Ågren 2025-04-12 8:58 ` Jean-Noël Avila 0 siblings, 1 reply; 19+ messages in thread From: Martin Ågren @ 2025-04-04 16:39 UTC (permalink / raw) To: Jean-Noël Avila via GitGitGadget; +Cc: git, Jean-Noël Avila On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget <gitgitgadget@gmail.com> wrote: > > The synopsis analysis logic was not able to handle backslashes and stars > which are used in the synopsis of the git-rm command. This patch fixes the > issue by updating the regular expression used to match the keywords. > --- a/Documentation/asciidoctor-extensions.rb.in > +++ b/Documentation/asciidoctor-extensions.rb.in > @@ -50,7 +50,7 @@ module Git > def process parent, reader, attrs > outlines = reader.lines.map do |l| > l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') > - .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') > + .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') > .gsub(']', ']{empty}') > end > @@ -72,7 +72,7 @@ module Git > %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) > elsif type == :monospaced > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') > - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') > + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') > else > open, close, supports_phrase = QUOTE_TAGS[type] > @@ -100,7 +100,7 @@ module Git > def convert_inline_quoted node > if node.type == :monospaced > node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') > - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') > + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') > .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') This seems to introduce some extra spacing in the rendered man pages, e.g., "The bundle.* keys" or "Fileglobs (e.g. *.c)". (Asciidoctor 2.0.18.) I haven't dug into the regexes so see what might be the cause. (I only had time to have a look at the first patch, then briefly trying out this one.) Martin ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/5] doc: fix synopsis analysis logic 2025-04-04 16:39 ` Martin Ågren @ 2025-04-12 8:58 ` Jean-Noël Avila 0 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila @ 2025-04-12 8:58 UTC (permalink / raw) To: Martin Ågren, Jean-Noël Avila via GitGitGadget; +Cc: git Le 05/04/2025 à 00:39, Martin Ågren a écrit : > On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget > <gitgitgadget@gmail.com> wrote: >> >> The synopsis analysis logic was not able to handle backslashes and stars >> which are used in the synopsis of the git-rm command. This patch fixes the >> issue by updating the regular expression used to match the keywords. > >> --- a/Documentation/asciidoctor-extensions.rb.in >> +++ b/Documentation/asciidoctor-extensions.rb.in >> @@ -50,7 +50,7 @@ module Git >> def process parent, reader, attrs >> outlines = reader.lines.map do |l| >> l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') >> - .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') >> + .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}') >> .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') >> .gsub(']', ']{empty}') >> end >> @@ -72,7 +72,7 @@ module Git >> %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) >> elsif type == :monospaced >> node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') >> - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') >> + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>') >> .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') >> else >> open, close, supports_phrase = QUOTE_TAGS[type] >> @@ -100,7 +100,7 @@ module Git >> def convert_inline_quoted node >> if node.type == :monospaced >> node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') >> - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') >> + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') >> .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') > > This seems to introduce some extra spacing in the rendered man pages, e.g., > "The bundle.* keys" or "Fileglobs (e.g. *.c)". (Asciidoctor 2.0.18.) I > haven't dug into the regexes so see what might be the cause. > The xml regex seems ok for this. The docbook output is as follows: (...) pairs in this list are in the <literal>bundle.*</literal> namespace (see (...) The manpage output seems also correct: (...) would accept (with the \fB\-\-file\fR option)\&. The key\-value pairs in this list are in the \fBbundle\&.*\fR namespace (see (...) Strangely, the --file above is rendered correctly, but the bundle.* below not. I do not know TROFF to assess what is going on. Has '*' a special behavior in a bold span? JN ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/5] doc: convert git-rm to new documentation format 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 1/5] doc: convert git-reset " Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 2/5] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 ` Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget ` (2 subsequent siblings) 5 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-rm.adoc | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/Documentation/git-rm.adoc b/Documentation/git-rm.adoc index 363a26934f5..b5ead867963 100644 --- a/Documentation/git-rm.adoc +++ b/Documentation/git-rm.adoc @@ -7,10 +7,10 @@ git-rm - Remove files from the working tree and from the index SYNOPSIS -------- -[verse] -'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] - [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]] - [--] [<pathspec>...] +[synopsis] +git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] + [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]] + [--] [<pathspec>...] DESCRIPTION ----------- @@ -30,7 +30,7 @@ sparse-checkouts are in use (see linkgit:git-sparse-checkout[1]), OPTIONS ------- -<pathspec>...:: +`<pathspec>...`:: Files to remove. A leading directory name (e.g. `dir` to remove `dir/file1` and `dir/file2`) can be given to remove all files in the directory, and recursively all sub-directories, but this @@ -43,57 +43,57 @@ directories `d` and `d2`, there is a difference between using `git rm 'd*'` and `git rm 'd/*'`, as the former will also remove all of directory `d2`. + -For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. +For more details, see the _<pathspec>_ entry in linkgit:gitglossary[7]. --f:: ---force:: +`-f`:: +`--force`:: Override the up-to-date check. --n:: ---dry-run:: +`-n`:: +`--dry-run`:: Don't actually remove any file(s). Instead, just show if they exist in the index and would otherwise be removed by the command. --r:: +`-r`:: Allow recursive removal when a leading directory name is given. -\--:: +`--`:: This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken for command-line options). ---cached:: +`--cached`:: Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. ---ignore-unmatch:: +`--ignore-unmatch`:: Exit with a zero status even if no files matched. ---sparse:: +`--sparse`:: Allow updating index entries outside of the sparse-checkout cone. Normally, `git rm` refuses to update index entries whose paths do not fit within the sparse-checkout cone. See linkgit:git-sparse-checkout[1] for more. --q:: ---quiet:: +`-q`:: +`--quiet`:: `git rm` normally outputs one line (in the form of an `rm` command) for each file removed. This option suppresses that output. ---pathspec-from-file=<file>:: - Pathspec is passed in `<file>` instead of commandline args. If - `<file>` is exactly `-` then standard input is used. Pathspec - elements are separated by LF or CR/LF. Pathspec elements can be +`--pathspec-from-file=<file>`:: + Pathspec is passed in _<file>_ instead of args. If + _<file>_ is exactly `-` then standard input is used. Pathspec + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). See also `--pathspec-file-nul` and global `--literal-pathspecs`. ---pathspec-file-nul:: +`--pathspec-file-nul`:: Only meaningful with `--pathspec-from-file`. Pathspec elements are - separated with NUL character and all other characters are taken + separated with _NUL_ character and all other characters are taken literally (including newlines and quotes). @@ -153,15 +153,15 @@ SUBMODULES ---------- Only submodules using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will be removed from the work -tree, as their repository lives inside the .git directory of the +tree, as their repository lives inside the `.git` directory of the superproject. If a submodule (or one of those nested inside it) -still uses a .git directory, `git rm` will move the submodules +still uses a `.git` directory, `git rm` moves the submodules git directory into the superprojects git directory to protect -the submodule's history. If it exists the submodule.<name> section +the submodule's history. If it exists the `submodule.<name>` section in the linkgit:gitmodules[5] file will also be removed and that file -will be staged (unless --cached or -n are used). +will be staged (unless `--cached` or `-n` are used). -A submodule is considered up to date when the HEAD is the same as +A submodule is considered up to date when the `HEAD` is the same as recorded in the index, no tracked files are modified and no untracked files that aren't ignored are present in the submodule's work tree. Ignored files are deemed expendable and won't stop a submodule's work -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget ` (2 preceding siblings ...) 2025-03-30 17:16 ` [PATCH 3/5] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 ` Jean-Noël Avila via GitGitGadget 2025-04-05 10:57 ` Martin Ågren 2025-03-30 17:16 ` [PATCH 5/5] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget 5 siblings, 1 reply; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> This also entails changing the help output for the command to match the new synopsis. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-mv.adoc | 6 ++---- builtin/mv.c | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Documentation/git-mv.adoc b/Documentation/git-mv.adoc index dc1bf615341..08d660643fc 100644 --- a/Documentation/git-mv.adoc +++ b/Documentation/git-mv.adoc @@ -9,15 +9,13 @@ git-mv - Move or rename a file, a directory, or a symlink SYNOPSIS -------- [verse] -'git mv' [<options>] <source>... <destination> +'git mv' [-v] [-f] [-n] [-k] <source> <destination> +'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory> DESCRIPTION ----------- Move or rename a file, directory, or symlink. - git mv [-v] [-f] [-n] [-k] <source> <destination> - git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> - In the first form, it renames <source>, which must exist and be either a file, symlink or directory, to <destination>. In the second form, the last argument has to be an existing diff --git a/builtin/mv.c b/builtin/mv.c index 55a7d471dca..9e36b616ab6 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -28,7 +28,8 @@ #include "entry.h" static const char * const builtin_mv_usage[] = { - N_("git mv [<options>] <source>... <destination>"), + N_("git mv [-v] [-f] [-n] [-k] <source> <destination>"), + N_("git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>"), NULL }; -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section 2025-03-30 17:16 ` [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget @ 2025-04-05 10:57 ` Martin Ågren 0 siblings, 0 replies; 19+ messages in thread From: Martin Ågren @ 2025-04-05 10:57 UTC (permalink / raw) To: Jean-Noël Avila via GitGitGadget; +Cc: git, Jean-Noël Avila On Sun, 30 Mar 2025 at 19:16, Jean-Noël Avila via GitGitGadget <gitgitgadget@gmail.com> wrote: > [verse] > -'git mv' [<options>] <source>... <destination> > +'git mv' [-v] [-f] [-n] [-k] <source> <destination> > +'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory> Shouldn't "..." be tucked with the preceding "<source>", i.e., "<source>..." as it was in the original? > DESCRIPTION > ----------- > Move or rename a file, directory, or symlink. > > - git mv [-v] [-f] [-n] [-k] <source> <destination> > - git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> > - This is where "<source> ..." comes from. You moved these lines up. Good. But I do think we want "<source>..."? Martin ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/5] doc: convert git-mv to new documentation format 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget ` (3 preceding siblings ...) 2025-03-30 17:16 ` [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget 5 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-03-30 17:16 UTC (permalink / raw) To: git; +Cc: Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Unfortunately, there's an inconsistency in the synopsis style, where the ellipsis is used to indicate that the option can be repeated, but it can also be used in Git's three-dot notation to indicate a range of commits. The rendering engine will not be able to distinguish between these two cases. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-mv.adoc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Documentation/git-mv.adoc b/Documentation/git-mv.adoc index 08d660643fc..a0b8118cf4f 100644 --- a/Documentation/git-mv.adoc +++ b/Documentation/git-mv.adoc @@ -8,17 +8,18 @@ git-mv - Move or rename a file, a directory, or a symlink SYNOPSIS -------- -[verse] -'git mv' [-v] [-f] [-n] [-k] <source> <destination> -'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory> + +[synopsis] +git mv [-v] [-f] [-n] [-k] <source> <destination> +git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> DESCRIPTION ----------- Move or rename a file, directory, or symlink. -In the first form, it renames <source>, which must exist and be either -a file, symlink or directory, to <destination>. -In the second form, the last argument has to be an existing +In the first form, it renames _<source>_, which must exist and be either +a file, symlink or directory, to _<destination>_. +In the second form, _<destination-directory>_ has to be an existing directory; the given sources will be moved into this directory. The index is updated after successful completion, but the change must still be @@ -26,20 +27,20 @@ committed. OPTIONS ------- --f:: ---force:: +`-f`:: +`--force`:: Force renaming or moving of a file even if the <destination> exists. --k:: +`-k`:: Skip move or rename actions which would lead to an error condition. An error happens when a source is neither existing nor controlled by Git, or when it would overwrite an existing file unless `-f` is given. --n:: ---dry-run:: +`-n`:: +`--dry-run`:: Do nothing; only show what would happen --v:: ---verbose:: +`-v`:: +`--verbose`:: Report the names of files as they are moved. SUBMODULES @@ -47,8 +48,8 @@ SUBMODULES Moving a submodule using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will update the gitfile and core.worktree setting to make the submodule work in the new location. -It also will attempt to update the submodule.<name>.path setting in -the linkgit:gitmodules[5] file and stage that file (unless -n is used). +It also will attempt to update the `submodule.<name>.path` setting in +the linkgit:gitmodules[5] file and stage that file (unless `-n` is used). BUGS ---- -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 0/7] doc: convert git-reset, git-rm and git-mv to new documentation format 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget ` (4 preceding siblings ...) 2025-03-30 17:16 ` [PATCH 5/5] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 1/7] doc: convert git-reset " Jean-Noël Avila via GitGitGadget ` (7 more replies) 5 siblings, 8 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila doc: convert git-reset, git-rm and git-mv to new documentation format change since V1: * fix remarks from reviewers * stack the commit fixing the handling of three-dot notation Jean-Noël Avila (7): doc: convert git-reset to new documentation format doc: fix synopsis analysis logic doc: convert git-rm to new documentation format doc: move synopsis git-mv commands in the synopsis section doc: convert git-mv to new documentation format doc: fix asciidoctor synopsis processing of triple-dots doc: add markup for characters in Guidelines Documentation/CodingGuidelines | 3 + Documentation/asciidoc.conf.in | 8 +- Documentation/asciidoctor-extensions.rb.in | 12 +-- Documentation/git-mv.adoc | 33 ++++---- Documentation/git-reset.adoc | 98 +++++++++++----------- Documentation/git-rm.adoc | 56 ++++++------- builtin/mv.c | 3 +- 7 files changed, 109 insertions(+), 104 deletions(-) base-commit: 485f5f863615e670fd97ae40af744e14072cfe18 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1896%2Fjnavila%2Fdoc_git_reset-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1896/jnavila/doc_git_reset-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/1896 Range-diff vs v1: 1: 1676b5ac628 ! 1: 5a6c7def260 doc: convert git-reset to new documentation format @@ Documentation/git-reset.adoc: and specifying a commit with `--source`, you +`--soft`:: Does not touch the index file or the working tree at all (but - resets the head to `<commit>`, just like all modes do). This leaves -- all your changed files "Changes to be committed", as `git status` + resets the head to _<commit>_, just like all modes do). This leaves -+ all your changed files "Changes to be committed", as `git status + all your changed files "Changes to be committed", as `git status` would put it. ---mixed:: 2: 6206e65ac4d = 2: 440eac1f974 doc: fix synopsis analysis logic 3: 41a01969d93 = 3: 6814e98f71d doc: convert git-rm to new documentation format 4: 9f7cd02cc1e = 4: 2a129734e3d doc: move synopsis git-mv commands in the synopsis section 5: 4887567c57c ! 5: 1868dfc3282 doc: convert git-mv to new documentation format @@ Documentation/git-mv.adoc: git-mv - Move or rename a file, a directory, or a sym + +[synopsis] +git mv [-v] [-f] [-n] [-k] <source> <destination> -+git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> ++git mv [-v] [-f] [-n] [-k] <source>... <destination-directory> DESCRIPTION ----------- @@ Documentation/git-mv.adoc: SUBMODULES BUGS ---- + + ## builtin/mv.c ## +@@ + + static const char * const builtin_mv_usage[] = { + N_("git mv [-v] [-f] [-n] [-k] <source> <destination>"), +- N_("git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>"), ++ N_("git mv [-v] [-f] [-n] [-k] <source>... <destination-directory>"), + NULL + }; + -: ----------- > 6: 2ddce76f14d doc: fix asciidoctor synopsis processing of triple-dots -: ----------- > 7: 2690f84602b doc: add markup for characters in Guidelines -- gitgitgadget ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 1/7] doc: convert git-reset to new documentation format 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 2/7] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget ` (6 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-reset.adoc | 98 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/Documentation/git-reset.adoc b/Documentation/git-reset.adoc index 79ad5643eed..53ab88c5451 100644 --- a/Documentation/git-reset.adoc +++ b/Documentation/git-reset.adoc @@ -7,23 +7,23 @@ git-reset - Reset current HEAD to the specified state SYNOPSIS -------- -[verse] -'git reset' [-q] [<tree-ish>] [--] <pathspec>... -'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] -'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...] -'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] +[synopsis] +git reset [-q] [<tree-ish>] [--] <pathspec>... +git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] +git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...] +git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>] DESCRIPTION ----------- -In the first three forms, copy entries from `<tree-ish>` to the index. -In the last form, set the current branch head (`HEAD`) to `<commit>`, +In the first three forms, copy entries from _<tree-ish>_ to the index. +In the last form, set the current branch head (`HEAD`) to _<commit>_, optionally modifying index and working tree to match. -The `<tree-ish>`/`<commit>` defaults to `HEAD` in all forms. +The _<tree-ish>_/_<commit>_ defaults to `HEAD` in all forms. -'git reset' [-q] [<tree-ish>] [--] <pathspec>...:: -'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]:: +`git reset [-q] [<tree-ish>] [--] <pathspec>...`:: +`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`:: These forms reset the index entries for all paths that match the - `<pathspec>` to their state at `<tree-ish>`. (It does not affect + _<pathspec>_ to their state at _<tree-ish>_. (It does not affect the working tree or the current branch.) + This means that `git reset <pathspec>` is the opposite of `git add @@ -37,30 +37,30 @@ and specifying a commit with `--source`, you can copy the contents of a path out of a commit to the index and to the working tree in one go. -'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...]:: +`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`:: Interactively select hunks in the difference between the index - and `<tree-ish>` (defaults to `HEAD`). The chosen hunks are applied + and _<tree-ish>_ (defaults to `HEAD`). The chosen hunks are applied in reverse to the index. + This means that `git reset -p` is the opposite of `git add -p`, i.e. -you can use it to selectively reset hunks. See the ``Interactive Mode'' +you can use it to selectively reset hunks. See the "Interactive Mode" section of linkgit:git-add[1] to learn how to operate the `--patch` mode. -'git reset' [<mode>] [<commit>]:: - This form resets the current branch head to `<commit>` and - possibly updates the index (resetting it to the tree of `<commit>`) and - the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD` - is set to the tip of the current branch. If `<mode>` is omitted, - defaults to `--mixed`. The `<mode>` must be one of the following: +`git reset [<mode>] [<commit>]`:: + This form resets the current branch head to _<commit>_ and + possibly updates the index (resetting it to the tree of _<commit>_) and + the working tree depending on _<mode>_. Before the operation, `ORIG_HEAD` + is set to the tip of the current branch. If _<mode>_ is omitted, + defaults to `--mixed`. The _<mode>_ must be one of the following: + -- ---soft:: +`--soft`:: Does not touch the index file or the working tree at all (but - resets the head to `<commit>`, just like all modes do). This leaves + resets the head to _<commit>_, just like all modes do). This leaves all your changed files "Changes to be committed", as `git status` would put it. ---mixed:: +`--mixed`:: Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action. @@ -68,33 +68,33 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode. If `-N` is specified, removed paths are marked as intent-to-add (see linkgit:git-add[1]). ---hard:: +`--hard`:: Resets the index and working tree. Any changes to tracked files in the - working tree since `<commit>` are discarded. Any untracked files or + working tree since _<commit>_ are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted. ---merge:: +`--merge`:: Resets the index and updates the files in the working tree that are - different between `<commit>` and `HEAD`, but keeps those which are + different between _<commit>_ and `HEAD`, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added). - If a file that is different between `<commit>` and the index has + If a file that is different between _<commit>_ and the index has unstaged changes, reset is aborted. + In other words, `--merge` does something like a `git read-tree -u -m <commit>`, but carries forward unmerged index entries. ---keep:: +`--keep`:: Resets index entries and updates files in the working tree that are - different between `<commit>` and `HEAD`. - If a file that is different between `<commit>` and `HEAD` has local + different between _<commit>_ and `HEAD`. + If a file that is different between _<commit>_ and `HEAD` has local changes, reset is aborted. ---[no-]recurse-submodules:: - When the working tree is updated, using --recurse-submodules will +`--[no-]recurse-submodules`:: + When the working tree is updated, using `--recurse-submodules` will also recursively reset the working tree of all active submodules according to the commit recorded in the superproject, also setting - the submodules' HEAD to be detached at that commit. + the submodules' `HEAD` to be detached at that commit. -- See "Reset, restore and revert" in linkgit:git[1] for the differences @@ -104,31 +104,31 @@ between the three commands. OPTIONS ------- --q:: ---quiet:: +`-q`:: +`--quiet`:: Be quiet, only report errors. ---refresh:: ---no-refresh:: +`--refresh`:: +`--no-refresh`:: Refresh the index after a mixed reset. Enabled by default. ---pathspec-from-file=<file>:: - Pathspec is passed in `<file>` instead of commandline args. If - `<file>` is exactly `-` then standard input is used. Pathspec - elements are separated by LF or CR/LF. Pathspec elements can be +`--pathspec-from-file=<file>`:: + Pathspec is passed in _<file>_ instead of commandline args. If + _<file>_ is exactly `-` then standard input is used. Pathspec + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). See also `--pathspec-file-nul` and global `--literal-pathspecs`. ---pathspec-file-nul:: +`--pathspec-file-nul`:: Only meaningful with `--pathspec-from-file`. Pathspec elements are - separated with NUL character and all other characters are taken + separated with _NUL_ character and all other characters are taken literally (including newlines and quotes). -\--:: +`--`:: Do not interpret any more arguments as options. -<pathspec>...:: +`<pathspec>...`:: Limits the paths affected by the operation. + For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. @@ -348,7 +348,7 @@ $ git commit ... <8> ------------ + <1> First, reset the history back one commit so that we remove the original - commit, but leave the working tree with all the changes. The -N ensures + commit, but leave the working tree with all the changes. The `-N` ensures that any new files added with `HEAD` are still marked so that `git add -p` will find them. <2> Next, we interactively select diff hunks to add using the `git add -p` @@ -458,7 +458,7 @@ working index HEAD target working index HEAD --keep B C C .... -`reset --merge` is meant to be used when resetting out of a conflicted +`git reset --merge` is meant to be used when resetting out of a conflicted merge. Any mergy operation guarantees that the working tree file that is involved in the merge does not have a local change with respect to the index before it starts, and that it writes the result out to the working tree. So if @@ -467,7 +467,7 @@ between the index and the working tree, then it means that we are not resetting out from a state that a mergy operation left after failing with a conflict. That is why we disallow `--merge` option in this case. -`reset --keep` is meant to be used when removing some of the last +`git reset --keep` is meant to be used when removing some of the last commits in the current branch while keeping changes in the working tree. If there could be conflicts between the changes in the commit we want to remove and the changes in the working tree we want to keep, -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 2/7] doc: fix synopsis analysis logic 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 1/7] doc: convert git-reset " Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 3/7] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget ` (5 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> The synopsis analysis logic was not able to handle backslashes and stars which are used in the synopsis of the git-rm command. This patch fixes the issue by updating the regular expression used to match the keywords. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/asciidoc.conf.in | 8 ++++---- Documentation/asciidoctor-extensions.rb.in | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/asciidoc.conf.in b/Documentation/asciidoc.conf.in index f2aef6cb79f..50f0e81a831 100644 --- a/Documentation/asciidoc.conf.in +++ b/Documentation/asciidoc.conf.in @@ -43,7 +43,7 @@ ifdef::doctype-book[] endif::doctype-book[] [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-docbook[] @@ -75,18 +75,18 @@ git-relative-html-prefix= <a href="{git-relative-html-prefix}{target}.html">{target}{0?({0})}</a> [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<em>\1</em>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\/_^\$]+\.?)+)',r'\1<code>\2</code>', re.sub(r'(\.\.\.?)([^\]$.])', r'<code>\1</code>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<em>\1</em>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<code>\2</code>', re.sub(r'(\.\.\.?)([^\]$.])', r'<code>\1</code>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-xhtml11[] ifdef::backend-docbook[] ifdef::doctype-manpage[] [paradef-default] -synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<phrase>\\0</phrase>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<literal>\\2</literal>!g;s!<[-a-zA-Z0-9.]\\+>!<emphasis>\\0</emphasis>!g'" +synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<phrase>\\0</phrase>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.\\\\\\*]\\+\\|…\\)!\\1<literal>\\2</literal>!g;s!<[-a-zA-Z0-9.]\\+>!<emphasis>\\0</emphasis>!g'" endif::doctype-manpage[] endif::backend-docbook[] ifdef::backend-xhtml11[] [paradef-default] -synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<span>\\0</span>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.]\\+\\|…\\)!\\1<code>\\2</code>!g;s!<[-a-zA-Z0-9.]\\+>!<em>\\0</em>!g'" +synopsis-style=template="verseparagraph",filter="sed 's!…\\(\\]\\|$\\)!<span>\\0</span>!g;s!\\([\\[ |()]\\|^\\|\\]\\|>\\)\\([-=a-zA-Z0-9:+@,\\/_^\\$.\\\\\\*]\\+\\|…\\)!\\1<code>\\2</code>!g;s!<[-a-zA-Z0-9.]\\+>!<em>\\0</em>!g'" endif::backend-xhtml11[] diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index 2494f17a514..09156b71a4f 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -50,7 +50,7 @@ module Git def process parent, reader, attrs outlines = reader.lines.map do |l| l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') - .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$]+)}, '\1{empty}`\2`{empty}') + .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}') .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') .gsub(']', ']{empty}') end @@ -72,7 +72,7 @@ module Git %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) elsif type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<literal>\2</literal>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') else open, close, supports_phrase = QUOTE_TAGS[type] @@ -100,7 +100,7 @@ module Git def convert_inline_quoted node if node.type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$]+\.{0,2})+)}, '\1<code>\2</code>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') else -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 3/7] doc: convert git-rm to new documentation format 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 1/7] doc: convert git-reset " Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 2/7] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 4/7] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget ` (4 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-rm.adoc | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/Documentation/git-rm.adoc b/Documentation/git-rm.adoc index 363a26934f5..b5ead867963 100644 --- a/Documentation/git-rm.adoc +++ b/Documentation/git-rm.adoc @@ -7,10 +7,10 @@ git-rm - Remove files from the working tree and from the index SYNOPSIS -------- -[verse] -'git rm' [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] - [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]] - [--] [<pathspec>...] +[synopsis] +git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] + [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]] + [--] [<pathspec>...] DESCRIPTION ----------- @@ -30,7 +30,7 @@ sparse-checkouts are in use (see linkgit:git-sparse-checkout[1]), OPTIONS ------- -<pathspec>...:: +`<pathspec>...`:: Files to remove. A leading directory name (e.g. `dir` to remove `dir/file1` and `dir/file2`) can be given to remove all files in the directory, and recursively all sub-directories, but this @@ -43,57 +43,57 @@ directories `d` and `d2`, there is a difference between using `git rm 'd*'` and `git rm 'd/*'`, as the former will also remove all of directory `d2`. + -For more details, see the 'pathspec' entry in linkgit:gitglossary[7]. +For more details, see the _<pathspec>_ entry in linkgit:gitglossary[7]. --f:: ---force:: +`-f`:: +`--force`:: Override the up-to-date check. --n:: ---dry-run:: +`-n`:: +`--dry-run`:: Don't actually remove any file(s). Instead, just show if they exist in the index and would otherwise be removed by the command. --r:: +`-r`:: Allow recursive removal when a leading directory name is given. -\--:: +`--`:: This option can be used to separate command-line options from the list of files, (useful when filenames might be mistaken for command-line options). ---cached:: +`--cached`:: Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. ---ignore-unmatch:: +`--ignore-unmatch`:: Exit with a zero status even if no files matched. ---sparse:: +`--sparse`:: Allow updating index entries outside of the sparse-checkout cone. Normally, `git rm` refuses to update index entries whose paths do not fit within the sparse-checkout cone. See linkgit:git-sparse-checkout[1] for more. --q:: ---quiet:: +`-q`:: +`--quiet`:: `git rm` normally outputs one line (in the form of an `rm` command) for each file removed. This option suppresses that output. ---pathspec-from-file=<file>:: - Pathspec is passed in `<file>` instead of commandline args. If - `<file>` is exactly `-` then standard input is used. Pathspec - elements are separated by LF or CR/LF. Pathspec elements can be +`--pathspec-from-file=<file>`:: + Pathspec is passed in _<file>_ instead of args. If + _<file>_ is exactly `-` then standard input is used. Pathspec + elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). See also `--pathspec-file-nul` and global `--literal-pathspecs`. ---pathspec-file-nul:: +`--pathspec-file-nul`:: Only meaningful with `--pathspec-from-file`. Pathspec elements are - separated with NUL character and all other characters are taken + separated with _NUL_ character and all other characters are taken literally (including newlines and quotes). @@ -153,15 +153,15 @@ SUBMODULES ---------- Only submodules using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will be removed from the work -tree, as their repository lives inside the .git directory of the +tree, as their repository lives inside the `.git` directory of the superproject. If a submodule (or one of those nested inside it) -still uses a .git directory, `git rm` will move the submodules +still uses a `.git` directory, `git rm` moves the submodules git directory into the superprojects git directory to protect -the submodule's history. If it exists the submodule.<name> section +the submodule's history. If it exists the `submodule.<name>` section in the linkgit:gitmodules[5] file will also be removed and that file -will be staged (unless --cached or -n are used). +will be staged (unless `--cached` or `-n` are used). -A submodule is considered up to date when the HEAD is the same as +A submodule is considered up to date when the `HEAD` is the same as recorded in the index, no tracked files are modified and no untracked files that aren't ignored are present in the submodule's work tree. Ignored files are deemed expendable and won't stop a submodule's work -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 4/7] doc: move synopsis git-mv commands in the synopsis section 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget ` (2 preceding siblings ...) 2025-04-12 12:20 ` [PATCH v2 3/7] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 5/7] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget ` (3 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> This also entails changing the help output for the command to match the new synopsis. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-mv.adoc | 6 ++---- builtin/mv.c | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Documentation/git-mv.adoc b/Documentation/git-mv.adoc index dc1bf615341..08d660643fc 100644 --- a/Documentation/git-mv.adoc +++ b/Documentation/git-mv.adoc @@ -9,15 +9,13 @@ git-mv - Move or rename a file, a directory, or a symlink SYNOPSIS -------- [verse] -'git mv' [<options>] <source>... <destination> +'git mv' [-v] [-f] [-n] [-k] <source> <destination> +'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory> DESCRIPTION ----------- Move or rename a file, directory, or symlink. - git mv [-v] [-f] [-n] [-k] <source> <destination> - git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory> - In the first form, it renames <source>, which must exist and be either a file, symlink or directory, to <destination>. In the second form, the last argument has to be an existing diff --git a/builtin/mv.c b/builtin/mv.c index 55a7d471dca..9e36b616ab6 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -28,7 +28,8 @@ #include "entry.h" static const char * const builtin_mv_usage[] = { - N_("git mv [<options>] <source>... <destination>"), + N_("git mv [-v] [-f] [-n] [-k] <source> <destination>"), + N_("git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>"), NULL }; -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 5/7] doc: convert git-mv to new documentation format 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget ` (3 preceding siblings ...) 2025-04-12 12:20 ` [PATCH v2 4/7] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 6/7] doc: fix asciidoctor synopsis processing of triple-dots Jean-Noël Avila via GitGitGadget ` (2 subsequent siblings) 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> - Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Unfortunately, there's an inconsistency in the synopsis style, where the ellipsis is used to indicate that the option can be repeated, but it can also be used in Git's three-dot notation to indicate a range of commits. The rendering engine will not be able to distinguish between these two cases. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/git-mv.adoc | 31 ++++++++++++++++--------------- builtin/mv.c | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Documentation/git-mv.adoc b/Documentation/git-mv.adoc index 08d660643fc..f707e998f77 100644 --- a/Documentation/git-mv.adoc +++ b/Documentation/git-mv.adoc @@ -8,17 +8,18 @@ git-mv - Move or rename a file, a directory, or a symlink SYNOPSIS -------- -[verse] -'git mv' [-v] [-f] [-n] [-k] <source> <destination> -'git mv' [-v] [-f] [-n] [-k] <source> ... <destination-directory> + +[synopsis] +git mv [-v] [-f] [-n] [-k] <source> <destination> +git mv [-v] [-f] [-n] [-k] <source>... <destination-directory> DESCRIPTION ----------- Move or rename a file, directory, or symlink. -In the first form, it renames <source>, which must exist and be either -a file, symlink or directory, to <destination>. -In the second form, the last argument has to be an existing +In the first form, it renames _<source>_, which must exist and be either +a file, symlink or directory, to _<destination>_. +In the second form, _<destination-directory>_ has to be an existing directory; the given sources will be moved into this directory. The index is updated after successful completion, but the change must still be @@ -26,20 +27,20 @@ committed. OPTIONS ------- --f:: ---force:: +`-f`:: +`--force`:: Force renaming or moving of a file even if the <destination> exists. --k:: +`-k`:: Skip move or rename actions which would lead to an error condition. An error happens when a source is neither existing nor controlled by Git, or when it would overwrite an existing file unless `-f` is given. --n:: ---dry-run:: +`-n`:: +`--dry-run`:: Do nothing; only show what would happen --v:: ---verbose:: +`-v`:: +`--verbose`:: Report the names of files as they are moved. SUBMODULES @@ -47,8 +48,8 @@ SUBMODULES Moving a submodule using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will update the gitfile and core.worktree setting to make the submodule work in the new location. -It also will attempt to update the submodule.<name>.path setting in -the linkgit:gitmodules[5] file and stage that file (unless -n is used). +It also will attempt to update the `submodule.<name>.path` setting in +the linkgit:gitmodules[5] file and stage that file (unless `-n` is used). BUGS ---- diff --git a/builtin/mv.c b/builtin/mv.c index 9e36b616ab6..d673a6c83ef 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -29,7 +29,7 @@ static const char * const builtin_mv_usage[] = { N_("git mv [-v] [-f] [-n] [-k] <source> <destination>"), - N_("git mv [-v] [-f] [-n] [-k] <source> ... <destination-directory>"), + N_("git mv [-v] [-f] [-n] [-k] <source>... <destination-directory>"), NULL }; -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 6/7] doc: fix asciidoctor synopsis processing of triple-dots 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget ` (4 preceding siblings ...) 2025-04-12 12:20 ` [PATCH v2 5/7] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 7/7] doc: add markup for characters in Guidelines Jean-Noël Avila via GitGitGadget 2025-04-14 21:47 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and git-mv to new documentation format Junio C Hamano 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> The processing of triple dot notation is tricky because it can be mis-interpreted as an ellipsis. The special processing of the ellipsis is now complete and takes into account the case of `git-mv <source>... <dest>` Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/asciidoc.conf.in | 2 +- Documentation/asciidoctor-extensions.rb.in | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/asciidoc.conf.in b/Documentation/asciidoc.conf.in index 50f0e81a831..9d9139306e6 100644 --- a/Documentation/asciidoc.conf.in +++ b/Documentation/asciidoc.conf.in @@ -43,7 +43,7 @@ ifdef::doctype-book[] endif::doctype-book[] [literal-inlinemacro] -{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,\\\*\/_^\$]+\.?)+)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} +{eval:re.sub(r'(<[-a-zA-Z0-9.]+>)', r'<emphasis>\1</emphasis>', re.sub(r'([\[\s|()>]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@\\\*\/_^\$]+\.?)+|,)',r'\1<literal>\2</literal>', re.sub(r'(\.\.\.?)([^\]$.])', r'<literal>\1</literal>\2', macros.passthroughs[int(attrs['passtext'][1:-1])] if attrs['passtext'][1:-1].isnumeric() else attrs['passtext'][1:-1])))} endif::backend-docbook[] diff --git a/Documentation/asciidoctor-extensions.rb.in b/Documentation/asciidoctor-extensions.rb.in index 09156b71a4f..8b7b1613496 100644 --- a/Documentation/asciidoctor-extensions.rb.in +++ b/Documentation/asciidoctor-extensions.rb.in @@ -49,7 +49,7 @@ module Git def process parent, reader, attrs outlines = reader.lines.map do |l| - l.gsub(/(\.\.\.?)([^\]$.])/, '`\1`\2') + l.gsub(/(\.\.\.?)([^\]$\. ])/, '{empty}`\1`{empty}\2') .gsub(%r{([\[\] |()>]|^)([-a-zA-Z0-9:+=~@,/_^\$\\\*]+)}, '\1{empty}`\2`{empty}') .gsub(/(<[-a-zA-Z0-9.]+>)/, '__\\1__') .gsub(']', ']{empty}') @@ -71,8 +71,9 @@ module Git # unhandled math; pass source to alt and required mathphrase element; dblatex will process alt as LaTeX math %(<inlineequation><alt><![CDATA[#{equation = node.text}]]></alt><mathphrase><![CDATA[#{equation}]]></mathphrase></inlineequation>) elsif type == :monospaced - node.text.gsub(/(\.\.\.?)([^\]$.])/, '<literal>\1</literal>\2') - .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<literal>\2</literal>') + node.text.gsub(/(\.\.\.?)([^\]$\.])/, '<literal>\1</literal>\2') + .gsub(/^\.\.\.?$/, '<literal>\0</literal>') + .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@/_^\$\\\*]+\.{0,2})+|,)}, '\1<literal>\2</literal>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<emphasis>\1</emphasis>') else open, close, supports_phrase = QUOTE_TAGS[type] @@ -100,6 +101,7 @@ module Git def convert_inline_quoted node if node.type == :monospaced node.text.gsub(/(\.\.\.?)([^\]$.])/, '<code>\1</code>\2') + .gsub(/^\.\.\.?$/, '<code>\0</code>') .gsub(%r{([\[\s|()>.]|^|\]|>)(\.?([-a-zA-Z0-9:+=~@,/_^\$\\\*]+\.{0,2})+)}, '\1<code>\2</code>') .gsub(/(<[-a-zA-Z0-9.]+>)/, '<em>\1</em>') -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 7/7] doc: add markup for characters in Guidelines 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget ` (5 preceding siblings ...) 2025-04-12 12:20 ` [PATCH v2 6/7] doc: fix asciidoctor synopsis processing of triple-dots Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 ` Jean-Noël Avila via GitGitGadget 2025-04-14 21:47 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and git-mv to new documentation format Junio C Hamano 7 siblings, 0 replies; 19+ messages in thread From: Jean-Noël Avila via GitGitGadget @ 2025-04-12 12:20 UTC (permalink / raw) To: git; +Cc: Martin Ågren, Jean-Noël Avila, Jean-Noël Avila From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> This rule was already implicitely applied in the converted man pages, so let's state it loudly. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> --- Documentation/CodingGuidelines | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index a0e7041c54b..c1046abfb7d 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -861,6 +861,9 @@ Markup: _<git-dir>_ _<key-id>_ +Characters are also surrounded by underscores: + _LF_, _CR_, _CR_/_LF_, _NUL_, _EOF_ + Git's Asciidoc processor has been tailored to treat backticked text as complex synopsis. When literal and placeholders are mixed, you can use the backtick notation which will take care of correctly typesetting -- gitgitgadget ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 0/7] doc: convert git-reset, git-rm and git-mv to new documentation format 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget ` (6 preceding siblings ...) 2025-04-12 12:20 ` [PATCH v2 7/7] doc: add markup for characters in Guidelines Jean-Noël Avila via GitGitGadget @ 2025-04-14 21:47 ` Junio C Hamano 7 siblings, 0 replies; 19+ messages in thread From: Junio C Hamano @ 2025-04-14 21:47 UTC (permalink / raw) To: Jean-Noël Avila via GitGitGadget Cc: git, Martin Ågren, Jean-Noël Avila "Jean-Noël Avila via GitGitGadget" <gitgitgadget@gmail.com> writes: > doc: convert git-reset, git-rm and git-mv to new documentation format > > change since V1: > > * fix remarks from reviewers > * stack the commit fixing the handling of three-dot notation > > Jean-Noël Avila (7): > doc: convert git-reset to new documentation format > doc: fix synopsis analysis logic > doc: convert git-rm to new documentation format > doc: move synopsis git-mv commands in the synopsis section > doc: convert git-mv to new documentation format It was very obvious that the updates for the above relative to the previous iteration are all good ones. > doc: fix asciidoctor synopsis processing of triple-dots I'll need to look at this a bit carefully, as regexp over <mark><up><language><input> tend to become pure gibberish ;-) > doc: add markup for characters in Guidelines Looking good. Will queue. Thanks. ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-04-14 21:47 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-03-30 17:15 [PATCH 0/5] doc: convert git-reset, git-rm and git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 1/5] doc: convert git-reset " Jean-Noël Avila via GitGitGadget 2025-04-04 16:39 ` Martin Ågren 2025-03-30 17:16 ` [PATCH 2/5] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget 2025-04-04 16:39 ` Martin Ågren 2025-04-12 8:58 ` Jean-Noël Avila 2025-03-30 17:16 ` [PATCH 3/5] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget 2025-03-30 17:16 ` [PATCH 4/5] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget 2025-04-05 10:57 ` Martin Ågren 2025-03-30 17:16 ` [PATCH 5/5] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and " Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 1/7] doc: convert git-reset " Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 2/7] doc: fix synopsis analysis logic Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 3/7] doc: convert git-rm to new documentation format Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 4/7] doc: move synopsis git-mv commands in the synopsis section Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 5/7] doc: convert git-mv to new documentation format Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 6/7] doc: fix asciidoctor synopsis processing of triple-dots Jean-Noël Avila via GitGitGadget 2025-04-12 12:20 ` [PATCH v2 7/7] doc: add markup for characters in Guidelines Jean-Noël Avila via GitGitGadget 2025-04-14 21:47 ` [PATCH v2 0/7] doc: convert git-reset, git-rm and git-mv to new documentation format Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).