# [PATCH] fix: include the type flag in the cli docs

9 messages from 2022-02-26 to 2022-03-04. Participants: Matheus Felipe via GitGitGadget, Bagas Sanjaya, Junio C Hamano, Ævar Arnfjörð Bjarmason, Matheus Felipe.
Thread: https://gitlist.dev/t/57478

## Matheus Felipe via GitGitGadget, 2022-02-26 05:34

Subject: [PATCH] fix: include the type flag in the cli docs
Message-ID: <pull.1220.git.git.1645853661519.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1220.git.git.1645853661519.gitgitgadget%40gmail.com

```
From: Matheus Felipe <matheusfelipeog@protonmail.com>

When the `git config --global --help` command is invoked,
the cli documentation is shown in the terminal with a small
error in one of the values of the Type group, which is the
absence of the type flag in the `--type` argument.
This commit fixes that.

Signed-off-by: Matheus Felipe <matheusfelipeog@protonmail.com>
---
    fix: include the type flag in the cli docs
    
    When the git config --global --help command is invoked, the cli
    documentation is shown in the terminal with a small error in one of the
    values of the Type group, which is the absence of the type flag in the
    --type argument:
    
    image
    [https://user-images.githubusercontent.com/50463866/155674905-01fcdf18-8f67-488a-b367-985040dfe57d.png]
    
    In the web documentation and man page:
    
    image
    [https://user-images.githubusercontent.com/50463866/155675353-4a39965a-875c-475c-829d-7849a982f5b9.png]
    image
    [https://user-images.githubusercontent.com/50463866/155675437-7283dbac-fff2-44b7-8733-7d5af375bce4.png]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1220%2Fmatheusfelipeog%2Ffix%2Fgit-config-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1220/matheusfelipeog/fix/git-config-docs-v1
Pull-Request: https://github.com/git/git/pull/1220

 builtin/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/config.c b/builtin/config.c
index 542d8d02b2b..2aea465466b 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -151,7 +151,7 @@ static struct option builtin_config_options[] = {
 	OPT_BIT(0, "get-color", &actions, N_("find the color configured: slot [default]"), ACTION_GET_COLOR),
 	OPT_BIT(0, "get-colorbool", &actions, N_("find the color setting: slot [stdout-is-tty]"), ACTION_GET_COLORBOOL),
 	OPT_GROUP(N_("Type")),
-	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
+	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
 	OPT_CALLBACK_VALUE(0, "bool", &type, N_("value is \"true\" or \"false\""), TYPE_BOOL),
 	OPT_CALLBACK_VALUE(0, "int", &type, N_("value is decimal number"), TYPE_INT),
 	OPT_CALLBACK_VALUE(0, "bool-or-int", &type, N_("value is --bool or --int"), TYPE_BOOL_OR_INT),

base-commit: dab1b7905d0b295f1acef9785bb2b9cbb0fdec84
-- 
gitgitgadget

```

## Bagas Sanjaya, 2022-02-27 04:29

Subject: Re: [PATCH] fix: include the type flag in the cli docs
Message-ID: <f171e157-7dbc-b07e-7164-c62e2427fbe2@gmail.com>
URL: https://gitlist.dev/e/f171e157-7dbc-b07e-7164-c62e2427fbe2%40gmail.com
In-Reply-To: <pull.1220.git.git.1645853661519.gitgitgadget@gmail.com>

```
On 26/02/22 12.34, Matheus Felipe via GitGitGadget wrote:
> From: Matheus Felipe <matheusfelipeog@protonmail.com>
> 
> When the `git config --global --help` command is invoked,
> the cli documentation is shown in the terminal with a small
> error in one of the values of the Type group, which is the
> absence of the type flag in the `--type` argument.
> This commit fixes that.
> 

What about the commit message below?

ˋˋˋ
The usage help for --type option of `git config` is missing `type`
in the argument placeholder (`<>`). Add it.
ˋˋˋ

> -	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
> +	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),


The help should be `give the value the specified type`.

-- 
An old man doll... just what I always wanted! - Clara

```

## Junio C Hamano, 2022-02-27 19:48

Subject: Re: [PATCH] fix: include the type flag in the cli docs
Message-ID: <xmqqilt03xat.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqilt03xat.fsf%40gitster.g
In-Reply-To: <f171e157-7dbc-b07e-7164-c62e2427fbe2@gmail.com>

```
Bagas Sanjaya <bagasdotme@gmail.com> writes:

> On 26/02/22 12.34, Matheus Felipe via GitGitGadget wrote:
>> From: Matheus Felipe <matheusfelipeog@protonmail.com>
>> When the `git config --global --help` command is invoked,
>> the cli documentation is shown in the terminal with a small
>> error in one of the values of the Type group, which is the
>> absence of the type flag in the `--type` argument.
>> This commit fixes that.
>> 
>
> What about the commit message below?
>
> ˋˋˋ
> The usage help for --type option of `git config` is missing `type`
> in the argument placeholder (`<>`). Add it.
> ˋˋˋ

It is more concise, and at the same time points out the problem
being addressed a lot more explicitly.  Much better.

>> -	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
>> +	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
>
>
> The help should be `give the value the specified type`.

I am not sure if this is much of an improvement.

    $ git config --type=bool junk.flag 0
    $ git config junk.flag
    false

uses the type information to turn "0" into "false" before it writes
the value set to the variable to the file, while

    $ git config junk.flag 0
    $ git config junk.flag
    0
    $ git config --type=bool junk.flag
    false

shows that a stored value of "0" can be turned into "false" when
showing.  "Give the value the specified type" does not capture the
essense in either direction.

    Before setting or showing, convert the value to its canonical
    representation according to the given type.

is what we want to convey, but it is quote a mouthful as-is.

Saying "Assume the value is of this type" would strongly imply
"Convert ... to its canonical reporesentation", and the current
"value is given this type" may be a close enough and shorter
approximation of it.  I dunno.


```

## Ævar Arnfjörð Bjarmason, 2022-02-28 22:42

Subject: Re: [PATCH] fix: include the type flag in the cli docs
Message-ID: <220228.86a6ea38z9.gmgdl@evledraar.gmail.com>
URL: https://gitlist.dev/e/220228.86a6ea38z9.gmgdl%40evledraar.gmail.com
In-Reply-To: <xmqqilt03xat.fsf@gitster.g>

```

On Sun, Feb 27 2022, Junio C Hamano wrote:

> Bagas Sanjaya <bagasdotme@gmail.com> writes:
>
>> On 26/02/22 12.34, Matheus Felipe via GitGitGadget wrote:
>>> From: Matheus Felipe <matheusfelipeog@protonmail.com>
>>> When the `git config --global --help` command is invoked,
>>> the cli documentation is shown in the terminal with a small
>>> error in one of the values of the Type group, which is the
>>> absence of the type flag in the `--type` argument.
>>> This commit fixes that.
>>> 
>>
>> What about the commit message below?
>>
>> ˋˋˋ
>> The usage help for --type option of `git config` is missing `type`
>> in the argument placeholder (`<>`). Add it.
>> ˋˋˋ
>
> It is more concise, and at the same time points out the problem
> being addressed a lot more explicitly.  Much better.
>
>>> -	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
>>> +	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
>>
>>
>> The help should be `give the value the specified type`.
>
> I am not sure if this is much of an improvement.
>
>     $ git config --type=bool junk.flag 0
>     $ git config junk.flag
>     false
>
> uses the type information to turn "0" into "false" before it writes
> the value set to the variable to the file, while
>
>     $ git config junk.flag 0
>     $ git config junk.flag
>     0
>     $ git config --type=bool junk.flag
>     false
>
> shows that a stored value of "0" can be turned into "false" when
> showing.  "Give the value the specified type" does not capture the
> essense in either direction.
>
>     Before setting or showing, convert the value to its canonical
>     representation according to the given type.
>
> is what we want to convey, but it is quote a mouthful as-is.
>
> Saying "Assume the value is of this type" would strongly imply
> "Convert ... to its canonical reporesentation", and the current
> "value is given this type" may be a close enough and shorter
> approximation of it.  I dunno.

Perhaps:

	"coerce (on read and write) <value> to <type>"

or:

	"coerce (on read & write) <value> to <type>"

or:

	"coerce (on rw) <value> to <type>"

For the short help, depending on how verbose we'd like to be?

In any case a follow-up fix, just the "" to "type" being proposed here
is orthagonal & looks good to me.


```

## Matheus Felipe, 2022-03-04 03:56

Subject: Re: [PATCH] fix: include the type flag in the cli docs
Message-ID: <Uywg4gVveJ2mBefUUQDfm4i2U4gv2dk_MDNu1GhqklSMya5McKJ7n8enKWDFq_mWrfWlSDlxwSVBNwEAuq27osjfDNJziIy0EIE0nsVmsqM=@protonmail.com>
URL: https://gitlist.dev/e/Uywg4gVveJ2mBefUUQDfm4i2U4gv2dk_MDNu1GhqklSMya5McKJ7n8enKWDFq_mWrfWlSDlxwSVBNwEAuq27osjfDNJziIy0EIE0nsVmsqM%3D%40protonmail.com
In-Reply-To: <220228.86a6ea38z9.gmgdl@evledraar.gmail.com>

```
> On 26/02/22 12.34, Matheus Felipe via GitGitGadget wrote:
>
> > From: Matheus Felipe matheusfelipeog@protonmail.com
> > When the `git config --global --help` command is invoked,
> > the cli documentation is shown in the terminal with a small
> > error in one of the values of the Type group, which is the
> > absence of the type flag in the `--type` argument.
> > This commit fixes that.
>
> What about the commit message below?
>
> ˋˋˋ
> The usage help for --type option of `git config` is missing `type`
> in the argument placeholder (`<>`). Add it.
> ˋˋˋ

This commit message just got better, thanks. I will update with this message.

> > - OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
> > + OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
>
> The help should be `give the value the specified type`.

About the help message, I believe the current one is adequate, as Junio C Hamano well described.

It is also worth remembering that PR proposes a change from "" to "type" only, as recalled by Ævar Arnfjörð Bjarmason.


```

## Matheus Felipe via GitGitGadget, 2022-03-04 04:31

Subject: [PATCH v2] fix: include the type flag in the cli docs
Message-ID: <pull.1220.v2.git.git.1646368313714.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1220.v2.git.git.1646368313714.gitgitgadget%40gmail.com
In-Reply-To: <pull.1220.git.git.1645853661519.gitgitgadget@gmail.com>

```
From: Matheus Felipe <matheusfelipeog@protonmail.com>

The usage help for --type option of `git config` is missing `type`
in the argument placeholder (`<>`). Add it.

Signed-off-by: Matheus Felipe <matheusfelipeog@protonmail.com>
---
    fix: include the type flag in the cli docs
    
    When the git config --global --help command is invoked, the cli
    documentation is shown in the terminal with a small error in one of the
    values of the Type group, which is the absence of the type flag in the
    --type argument:
    
    image
    [https://user-images.githubusercontent.com/50463866/155674905-01fcdf18-8f67-488a-b367-985040dfe57d.png]
    
    In the web documentation and man page:
    
    image
    [https://user-images.githubusercontent.com/50463866/155675353-4a39965a-875c-475c-829d-7849a982f5b9.png]
    image
    [https://user-images.githubusercontent.com/50463866/155675437-7283dbac-fff2-44b7-8733-7d5af375bce4.png]
    
    ------------------------------------------------------------------------
    
    Changes since v1:
    
     * Added a better commit message (as suggested by Bagas Sanjaya
       <bagasdotme@gmail.com>)
    
    ------------------------------------------------------------------------

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1220%2Fmatheusfelipeog%2Ffix%2Fgit-config-docs-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1220/matheusfelipeog/fix/git-config-docs-v2
Pull-Request: https://github.com/git/git/pull/1220

Range-diff vs v1:

 1:  7bc0abde8ff ! 1:  1550d29f5da fix: include the type flag in the cli docs
     @@ Metadata
       ## Commit message ##
          fix: include the type flag in the cli docs
      
     -    When the `git config --global --help` command is invoked,
     -    the cli documentation is shown in the terminal with a small
     -    error in one of the values of the Type group, which is the
     -    absence of the type flag in the `--type` argument.
     -    This commit fixes that.
     +    The usage help for --type option of `git config` is missing `type`
     +    in the argument placeholder (`<>`). Add it.
      
          Signed-off-by: Matheus Felipe <matheusfelipeog@protonmail.com>
      


 builtin/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/config.c b/builtin/config.c
index 542d8d02b2b..2aea465466b 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -151,7 +151,7 @@ static struct option builtin_config_options[] = {
 	OPT_BIT(0, "get-color", &actions, N_("find the color configured: slot [default]"), ACTION_GET_COLOR),
 	OPT_BIT(0, "get-colorbool", &actions, N_("find the color setting: slot [stdout-is-tty]"), ACTION_GET_COLORBOOL),
 	OPT_GROUP(N_("Type")),
-	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
+	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
 	OPT_CALLBACK_VALUE(0, "bool", &type, N_("value is \"true\" or \"false\""), TYPE_BOOL),
 	OPT_CALLBACK_VALUE(0, "int", &type, N_("value is decimal number"), TYPE_INT),
 	OPT_CALLBACK_VALUE(0, "bool-or-int", &type, N_("value is --bool or --int"), TYPE_BOOL_OR_INT),

base-commit: dab1b7905d0b295f1acef9785bb2b9cbb0fdec84
-- 
gitgitgadget

```

## Junio C Hamano, 2022-03-04 07:45

Subject: Re: [PATCH v2] fix: include the type flag in the cli docs
Message-ID: <xmqq8rtq2may.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq8rtq2may.fsf%40gitster.g
In-Reply-To: <pull.1220.v2.git.git.1646368313714.gitgitgadget@gmail.com>

```
"Matheus Felipe via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH v2] fix: include the type flag in the cli docs

One more (hopefully final) nit.  By reading the above alone (which
is what people will see in "git shortlog --no-merges" output), you
can not even guess which subcommand the "fix" is about, or if it is
even a fix to the code, or just a documentation update.

I'd retitle it to

	config: correct "--type" option in "git config -h" output

> From: Matheus Felipe <matheusfelipeog@protonmail.com>
>
> The usage help for --type option of `git config` is missing `type`
> in the argument placeholder (`<>`). Add it.

Good.

> diff --git a/builtin/config.c b/builtin/config.c
> index 542d8d02b2b..2aea465466b 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -151,7 +151,7 @@ static struct option builtin_config_options[] = {
>  	OPT_BIT(0, "get-color", &actions, N_("find the color configured: slot [default]"), ACTION_GET_COLOR),
>  	OPT_BIT(0, "get-colorbool", &actions, N_("find the color setting: slot [stdout-is-tty]"), ACTION_GET_COLORBOOL),
>  	OPT_GROUP(N_("Type")),
> -	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
> +	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),

Good again.

Thanks.  Will queue.

```

## Matheus Felipe, 2022-03-04 15:52

Subject: Re: [PATCH v2] fix: include the type flag in the cli docs
Message-ID: <wPjDF_MqZ9RmGuEcyP_8axDVW9K7gfBaiycvgu6MM0UeW2ovCLDD5PqOVf7Q56aNGdFqaKUQvnOsoPW_0lj7matX-HmMGaL-uwhE8hrcPyA=@protonmail.com>
URL: https://gitlist.dev/e/wPjDF_MqZ9RmGuEcyP_8axDVW9K7gfBaiycvgu6MM0UeW2ovCLDD5PqOVf7Q56aNGdFqaKUQvnOsoPW_0lj7matX-HmMGaL-uwhE8hrcPyA%3D%40protonmail.com
In-Reply-To: <xmqq8rtq2may.fsf@gitster.g>

```
> One more (hopefully final) nit. By reading the above alone (which
> is what people will see in "git shortlog --no-merges" output), you
> can not even guess which subcommand the "fix" is about, or if it is
> even a fix to the code, or just a documentation update.
>
> I'd retitle it to
>
> config: correct "--type" option in "git config -h" output

You are right, this title is much better. I will update it.

Thank you very much, I learned a few things from this contribution.


```

## Matheus Felipe via GitGitGadget, 2022-03-04 16:15

Subject: [PATCH v3] config: correct "--type" option in "git config -h" output
Message-ID: <pull.1220.v3.git.git.1646410557888.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1220.v3.git.git.1646410557888.gitgitgadget%40gmail.com
In-Reply-To: <pull.1220.v2.git.git.1646368313714.gitgitgadget@gmail.com>

```
From: Matheus Felipe <matheusfelipeog@protonmail.com>

The usage help for --type option of `git config` is missing `type`
in the argument placeholder (`<>`). Add it.

Signed-off-by: Matheus Felipe <matheusfelipeog@protonmail.com>
---
    config: correct "--type" option in "git config -h" output
    
    When the git config --global --help command is invoked, the cli
    documentation is shown in the terminal with a small error in one of the
    values of the Type group, which is the absence of the type flag in the
    --type argument:
    
    image
    [https://user-images.githubusercontent.com/50463866/155674905-01fcdf18-8f67-488a-b367-985040dfe57d.png]
    
    In the web documentation and man page:
    
    image
    [https://user-images.githubusercontent.com/50463866/155675353-4a39965a-875c-475c-829d-7849a982f5b9.png]
    image
    [https://user-images.githubusercontent.com/50463866/155675437-7283dbac-fff2-44b7-8733-7d5af375bce4.png]
    
    ------------------------------------------------------------------------
    
    Changes since v1:
    
     * Added a better commit message (as suggested by Bagas Sanjaya
       <bagasdotme@gmail.com>)
     * Improve the title of the commit, to make it more explicit when viewed
       with git shortlog --no-merges (as suggested by Junio C Hamano
       <gitster@pobox.com>)
    
    ------------------------------------------------------------------------

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1220%2Fmatheusfelipeog%2Ffix%2Fgit-config-docs-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1220/matheusfelipeog/fix/git-config-docs-v3
Pull-Request: https://github.com/git/git/pull/1220

Range-diff vs v2:

 1:  1550d29f5da ! 1:  f0fff5f3597 fix: include the type flag in the cli docs
     @@ Metadata
      Author: Matheus Felipe <matheusfelipeog@protonmail.com>
      
       ## Commit message ##
     -    fix: include the type flag in the cli docs
     +    config: correct "--type" option in "git config -h" output
      
          The usage help for --type option of `git config` is missing `type`
          in the argument placeholder (`<>`). Add it.


 builtin/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/config.c b/builtin/config.c
index 542d8d02b2b..2aea465466b 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -151,7 +151,7 @@ static struct option builtin_config_options[] = {
 	OPT_BIT(0, "get-color", &actions, N_("find the color configured: slot [default]"), ACTION_GET_COLOR),
 	OPT_BIT(0, "get-colorbool", &actions, N_("find the color setting: slot [stdout-is-tty]"), ACTION_GET_COLORBOOL),
 	OPT_GROUP(N_("Type")),
-	OPT_CALLBACK('t', "type", &type, "", N_("value is given this type"), option_parse_type),
+	OPT_CALLBACK('t', "type", &type, N_("type"), N_("value is given this type"), option_parse_type),
 	OPT_CALLBACK_VALUE(0, "bool", &type, N_("value is \"true\" or \"false\""), TYPE_BOOL),
 	OPT_CALLBACK_VALUE(0, "int", &type, N_("value is decimal number"), TYPE_INT),
 	OPT_CALLBACK_VALUE(0, "bool-or-int", &type, N_("value is --bool or --int"), TYPE_BOOL_OR_INT),

base-commit: dab1b7905d0b295f1acef9785bb2b9cbb0fdec84
-- 
gitgitgadget

```
