[v2] git-submodule.txt: fix AsciiDoc formatting error
diff mbox series

Message ID 2ae16375ba185bcaceb2ba3e8843db495f0044a6.1568657575.git.liu.denton@gmail.com
State New
Headers show
Series
  • [v2] git-submodule.txt: fix AsciiDoc formatting error
Related show

Commit Message

Denton Liu Sept. 16, 2019, 6:19 p.m. UTC
In b57e8119e6 (submodule: teach set-branch subcommand, 2019-02-08), the
`set-branch` subcommand was added for submodules. When the documentation
was written, the syntax for a "index term" in AsciiDoc was
accidentally used. This caused the documentation to be rendered as

	set-branch -d|--default)|(-b|--branch <branch> [--] <path>

instead of

	set-branch ((-d|--default)|(-b|--branch <branch>)) [--] <path>

In addition to this, the original documentation was possibly confusing
as it made it seem as if the `-b` option didn't accept a `<branch>`
argument.

Break `--default` and `--branch` into their own separate invocations to
make it obvious that these options are mutually exclusive. Also, this
removes the surrounding parentheses so that the "index term" syntax is
not triggered.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---

Thanks for reviewing, Junio.

I thought about it over the weekend and I hope that this is a good
compromise.

I looked through other options in the documentation and I couldn't find
any other places where a short-form was documented in the body instead
of in the summary line so I didn't want to introduce that with this
commit. I feel like it would be unfamiliar to someone who's used to
reading other Git documentation.

Also, I opted to separate the the options onto their own lines because
this makes it obvious that these two arguments are incompatible.
Hopefully, this assuages your concerns.

Range-diff against v1:
1:  796a25ee1e ! 1:  2ae16375ba git-submodule.txt: fix AsciiDoc formatting error
    @@ Commit message
     
         instead of
     
    -            set-branch (-d|--default)|(-b|--branch <branch>) [--] <path>
    +            set-branch ((-d|--default)|(-b|--branch <branch>)) [--] <path>
     
    -    Remove surrounding parentheses so that the "index term" syntax is not
    -    triggered (and because it looks nicer without them anyway ;) ).
    +    In addition to this, the original documentation was possibly confusing
    +    as it made it seem as if the `-b` option didn't accept a `<branch>`
    +    argument.
    +
    +    Break `--default` and `--branch` into their own separate invocations to
    +    make it obvious that these options are mutually exclusive. Also, this
    +    removes the surrounding parentheses so that the "index term" syntax is
    +    not triggered.
     
         Signed-off-by: Denton Liu <liu.denton@gmail.com>
     
    @@ Documentation/git-submodule.txt: submodule with the `--init` option.
      registered submodules, and update any nested submodules within.
      --
     -set-branch ((-d|--default)|(-b|--branch <branch>)) [--] <path>::
    -+set-branch (-d|--default)|(-b|--branch <branch>) [--] <path>::
    ++set-branch (-b|--branch) <branch> [--] <path>::
    ++set-branch (-d|--default) [--] <path>::
      	Sets the default remote tracking branch for the submodule. The
      	`--branch` option allows the remote branch to be specified. The
      	`--default` option removes the submodule.<name>.branch configuration

 Documentation/git-submodule.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Junio C Hamano Sept. 16, 2019, 7:25 p.m. UTC | #1
Denton Liu <liu.denton@gmail.com> writes:

> Break `--default` and `--branch` into their own separate invocations to
> make it obvious that these options are mutually exclusive.

That sounds even clearer than what the original wanted to do.  Very
good idea.

> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index 0ed5c24dc1..1f46380af2 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -173,7 +173,8 @@ submodule with the `--init` option.
>  If `--recursive` is specified, this command will recurse into the
>  registered submodules, and update any nested submodules within.
>  --
> -set-branch ((-d|--default)|(-b|--branch <branch>)) [--] <path>::
> +set-branch (-b|--branch) <branch> [--] <path>::
> +set-branch (-d|--default) [--] <path>::
>  	Sets the default remote tracking branch for the submodule. The
>  	`--branch` option allows the remote branch to be specified. The
>  	`--default` option removes the submodule.<name>.branch configuration

Patch
diff mbox series

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 0ed5c24dc1..1f46380af2 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -173,7 +173,8 @@  submodule with the `--init` option.
 If `--recursive` is specified, this command will recurse into the
 registered submodules, and update any nested submodules within.
 --
-set-branch ((-d|--default)|(-b|--branch <branch>)) [--] <path>::
+set-branch (-b|--branch) <branch> [--] <path>::
+set-branch (-d|--default) [--] <path>::
 	Sets the default remote tracking branch for the submodule. The
 	`--branch` option allows the remote branch to be specified. The
 	`--default` option removes the submodule.<name>.branch configuration