diff mbox series

doc/cat-file: allow --use-mailmap for --batch options

Message ID 20221029092513.73982-1-siddharthasthana31@gmail.com (mailing list archive)
State New, archived
Headers show
Series doc/cat-file: allow --use-mailmap for --batch options | expand

Commit Message

Siddharth Asthana Oct. 29, 2022, 9:25 a.m. UTC
The command git cat-file can now use the mailmap mechanism to replace
idents with their canonical versions for commit and tag objects. There
are several options like `--batch`, `--batch-check` and
`--batch-command` that can be combined with `--use-mailmap`. But, the
documentation for `--batch`, `--batch-check` and `--batch-command`
doesn't say so. This patch fixes that documentation.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: John Cai <johncai86@gmail.com>
Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
---

This patch was previously sent as the first patch of a 3 patch series for 
adding the mailmap support in git cat-file options:
https://lore.kernel.org/git/20220916205946.178925-2-siddharthasthana31@gmail.com/

Changes in v2:
- Fixed the names in trailers in the commit message
- Updated the documentation to clearly state that the `--batch-check`,
  `--batch-command` and `--batch` options can only be used with
  `--textconv`, `--filters` or `--use-mailmap`.
- Fixed formatting

Changes in v3:
- Fixed formatting

Changes in v4:
- Fixed some grammatical errors

 Documentation/git-cat-file.txt | 45 ++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 13 deletions(-)

Comments

Taylor Blau Oct. 29, 2022, 6:06 p.m. UTC | #1
Hi Siddharth,

On Sat, Oct 29, 2022 at 02:55:13PM +0530, Siddharth Asthana wrote:
> This patch was previously sent as the first patch of a 3 patch series for
> adding the mailmap support in git cat-file options:
> https://lore.kernel.org/git/20220916205946.178925-2-siddharthasthana31@gmail.com/

Why was this split off from the original series? I don't have a problem
queueing the two topics independently, but an explanation of how the two
interact would be appreciated.

E.g., does one depend on the other? Are they independent and can be
merged at will? Should the integrator expect merge conflicts?

Thanks,
Taylor
Christian Couder Oct. 30, 2022, 7:06 a.m. UTC | #2
Hi Taylor,

On Sat, Oct 29, 2022 at 8:06 PM Taylor Blau <me@ttaylorr.com> wrote:
>
> Hi Siddharth,
>
> On Sat, Oct 29, 2022 at 02:55:13PM +0530, Siddharth Asthana wrote:
> > This patch was previously sent as the first patch of a 3 patch series for
> > adding the mailmap support in git cat-file options:
> > https://lore.kernel.org/git/20220916205946.178925-2-siddharthasthana31@gmail.com/
>
> Why was this split off from the original series? I don't have a problem
> queueing the two topics independently, but an explanation of how the two
> interact would be appreciated.

I think it was split off from the original series because it's a
documentation fix that could hopefully have graduated faster, and
could perhaps have made it into v2.38.0. Or perhaps it could make it
in v2.38.2 if such a bug fix release is made.

> E.g., does one depend on the other? Are they independent and can be
> merged at will? Should the integrator expect merge conflicts?

The other patch series has some code changes that are independent, but
the documentation changes it makes should probably go on top of this.

Thanks,
Christian.
Taylor Blau Oct. 30, 2022, 6:07 p.m. UTC | #3
On Sun, Oct 30, 2022 at 08:06:19AM +0100, Christian Couder wrote:
> > Why was this split off from the original series? I don't have a problem
> > queueing the two topics independently, but an explanation of how the two
> > interact would be appreciated.
>
> I think it was split off from the original series because it's a
> documentation fix that could hopefully have graduated faster, and
> could perhaps have made it into v2.38.0. Or perhaps it could make it
> in v2.38.2 if such a bug fix release is made.

OK. Can we please get an updated round that clearly indicates which
version it is? There are several messages in this thread with the same
subject line and it is unclear which one reviewers are happy with.

Thanks,
Taylor
Christian Couder Oct. 31, 2022, 10:54 a.m. UTC | #4
On Sat, Oct 29, 2022 at 11:25 AM Siddharth Asthana
<siddharthasthana31@gmail.com> wrote:
>
> The command git cat-file can now use the mailmap mechanism to replace
> idents with their canonical versions for commit and tag objects. There
> are several options like `--batch`, `--batch-check` and
> `--batch-command` that can be combined with `--use-mailmap`. But, the
> documentation for `--batch`, `--batch-check` and `--batch-command`
> doesn't say so. This patch fixes that documentation.
>
> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: John Cai <johncai86@gmail.com>
> Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
> ---
>
> This patch was previously sent as the first patch of a 3 patch series for
> adding the mailmap support in git cat-file options:
> https://lore.kernel.org/git/20220916205946.178925-2-siddharthasthana31@gmail.com/

I think Taylor is probably right that there should be a version number
at the start of the subject line if the patch has already been sent
many times with the same subject and mostly the same content to the
list.

> Changes in v2:
> - Fixed the names in trailers in the commit message
> - Updated the documentation to clearly state that the `--batch-check`,
>   `--batch-command` and `--batch` options can only be used with
>   `--textconv`, `--filters` or `--use-mailmap`.
> - Fixed formatting
>
> Changes in v3:
> - Fixed formatting
>
> Changes in v4:
> - Fixed some grammatical errors

The version number should logically be "v4" according to the above.

>  Documentation/git-cat-file.txt | 45 ++++++++++++++++++++++++----------
>  1 file changed, 32 insertions(+), 13 deletions(-)
>
> diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
> index ec30b5c574..db2bba9b65 100644
> --- a/Documentation/git-cat-file.txt
> +++ b/Documentation/git-cat-file.txt
> @@ -89,26 +89,45 @@ OPTIONS
>  --batch::
>  --batch=<format>::
>         Print object information and contents for each object provided
> -       on stdin.  May not be combined with any other options or arguments
> -       except `--textconv` or `--filters`, in which case the input lines
> -       also need to specify the path, separated by whitespace.  See the
> -       section `BATCH OUTPUT` below for details.
> +       on stdin. May not be combined with any other options or arguments
> +       except --textconv, --filters, or --use-mailmap.
> +       +
> +       * When used with `--textconv` or `--filters`, the input lines
> +         must specify the path, separated by whitespace. See the section
> +         `BATCH OUTPUT` below for details.
> +       +
> +       * When used with `--use-mailmap`, the info command shows the size
> +         of the object as if the identities recorded in it were replaced
> +         by the mailmap mechanism.

Sorry to realize this only at this point but actually I think the
`info` command is only available when the `--batch-command` option is
used, not when the `--batch` option is used.

As the `--batch` option prints both object information (which includes
the size) and contents (which includes the idents), I think something
like the following should be used here:

       * When used with `--use-mailmap`, for commit and tag objects, the
          contents part of the output shows the identities replaced using the
          mailmap mechanism, while the information part of the output shows
          the size of the object as if it actually recorded the replacement
          identities.

>  --batch-check::
>  --batch-check=<format>::
> -       Print object information for each object provided on stdin.  May
> -       not be combined with any other options or arguments except
> -       `--textconv` or `--filters`, in which case the input lines also
> -       need to specify the path, separated by whitespace.  See the
> -       section `BATCH OUTPUT` below for details.
> +       Print object information for each object provided on stdin. May not be
> +       combined with any other options or arguments except --textconv, --filters
> +       or --use-mailmap.
> +       +
> +       * When used with `--textconv` or `--filters`, the input lines must
> +        specify the path, separated by whitespace. See the section
> +        `BATCH OUTPUT` below for details.
> +       +
> +       * When used with `--use-mailmap`, the info command shows the size
> +         of the object as if the identities recorded in it were replaced
> +         by the mailmap mechanism.

Same remark about the `info` command as above.

As the `--batch-check` option prints only object information (which
includes the size), I think something like the following should be
used here:

       * When used with `--use-mailmap`, for commit and tag objects, the
          printed object information shows the size of the object as if the
          identities recorded in it were replaced by the mailmap mechanism.

>  --batch-command::
>  --batch-command=<format>::
>         Enter a command mode that reads commands and arguments from stdin. May
> -       only be combined with `--buffer`, `--textconv` or `--filters`. In the
> -       case of `--textconv` or `--filters`, the input lines also need to specify
> -       the path, separated by whitespace. See the section `BATCH OUTPUT` below
> -       for details.
> +       only be combined with `--buffer`, `--textconv`, `--use-mailmap` or
> +       `--filters`.
> +       +
> +       * When used with `--textconv` or `--filters`, the input lines must
> +         specify the path, separated by whitespace. See the section
> +         `BATCH OUTPUT` below for details.
> +       +
> +       * When used with `--use-mailmap`, the info command shows the size
> +         of the object as if the identities recorded in it were replaced
> +         by the mailmap mechanism.

s/info command/`info` command/

And I think it could be interesting to add:

  - that it happens only for commits and tags, and
  - that when the `contents` command is used the idents are replaced.

So maybe something like:

       * When used with `--use-mailmap`, for commit and tag objects, the
         `contents` command shows the identities replaced using the
          mailmap mechanism, while the `info` command shows the size
          of the object as if it actually recorded the replacement
          identities.

Also this will become true only after your other patch series will be
merged. Which means that you should say somewhere that either

  - this patch should be merged only after the other patch series is merged, or
  - it's a bug that the `info` command doesn't show the size of the
updated object and this is going to be fixed soon by the other patch
series anyway.

Thanks for working on finishing this!
Christian.
Siddharth Asthana Nov. 13, 2022, 9:26 p.m. UTC | #5
On 31/10/22 16:24, Christian Couder wrote:
> On Sat, Oct 29, 2022 at 11:25 AM Siddharth Asthana
> <siddharthasthana31@gmail.com> wrote:
>>
>> The command git cat-file can now use the mailmap mechanism to replace
>> idents with their canonical versions for commit and tag objects. There
>> are several options like `--batch`, `--batch-check` and
>> `--batch-command` that can be combined with `--use-mailmap`. But, the
>> documentation for `--batch`, `--batch-check` and `--batch-command`
>> doesn't say so. This patch fixes that documentation.
>>
>> Mentored-by: Christian Couder <christian.couder@gmail.com>
>> Mentored-by: John Cai <johncai86@gmail.com>
>> Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
>> ---
>>
>> This patch was previously sent as the first patch of a 3 patch series for
>> adding the mailmap support in git cat-file options:
>> https://lore.kernel.org/git/20220916205946.178925-2-siddharthasthana31@gmail.com/
> 
> I think Taylor is probably right that there should be a version number
> at the start of the subject line if the patch has already been sent
> many times with the same subject and mostly the same content to the
> list.
> 
>> Changes in v2:
>> - Fixed the names in trailers in the commit message
>> - Updated the documentation to clearly state that the `--batch-check`,
>>    `--batch-command` and `--batch` options can only be used with
>>    `--textconv`, `--filters` or `--use-mailmap`.
>> - Fixed formatting
>>
>> Changes in v3:
>> - Fixed formatting
>>
>> Changes in v4:
>> - Fixed some grammatical errors
> 
> The version number should logically be "v4" according to the above.
> 
>>   Documentation/git-cat-file.txt | 45 ++++++++++++++++++++++++----------
>>   1 file changed, 32 insertions(+), 13 deletions(-)
>>
>> diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
>> index ec30b5c574..db2bba9b65 100644
>> --- a/Documentation/git-cat-file.txt
>> +++ b/Documentation/git-cat-file.txt
>> @@ -89,26 +89,45 @@ OPTIONS
>>   --batch::
>>   --batch=<format>::
>>          Print object information and contents for each object provided
>> -       on stdin.  May not be combined with any other options or arguments
>> -       except `--textconv` or `--filters`, in which case the input lines
>> -       also need to specify the path, separated by whitespace.  See the
>> -       section `BATCH OUTPUT` below for details.
>> +       on stdin. May not be combined with any other options or arguments
>> +       except --textconv, --filters, or --use-mailmap.
>> +       +
>> +       * When used with `--textconv` or `--filters`, the input lines
>> +         must specify the path, separated by whitespace. See the section
>> +         `BATCH OUTPUT` below for details.
>> +       +
>> +       * When used with `--use-mailmap`, the info command shows the size
>> +         of the object as if the identities recorded in it were replaced
>> +         by the mailmap mechanism.
> 
> Sorry to realize this only at this point but actually I think the
> `info` command is only available when the `--batch-command` option is
> used, not when the `--batch` option is used.
> 
> As the `--batch` option prints both object information (which includes
> the size) and contents (which includes the idents), I think something
> like the following should be used here:
> 
>         * When used with `--use-mailmap`, for commit and tag objects, the
>            contents part of the output shows the identities replaced using the
>            mailmap mechanism, while the information part of the output shows
>            the size of the object as if it actually recorded the replacement
>            identities.
> 
>>   --batch-check::
>>   --batch-check=<format>::
>> -       Print object information for each object provided on stdin.  May
>> -       not be combined with any other options or arguments except
>> -       `--textconv` or `--filters`, in which case the input lines also
>> -       need to specify the path, separated by whitespace.  See the
>> -       section `BATCH OUTPUT` below for details.
>> +       Print object information for each object provided on stdin. May not be
>> +       combined with any other options or arguments except --textconv, --filters
>> +       or --use-mailmap.
>> +       +
>> +       * When used with `--textconv` or `--filters`, the input lines must
>> +        specify the path, separated by whitespace. See the section
>> +        `BATCH OUTPUT` below for details.
>> +       +
>> +       * When used with `--use-mailmap`, the info command shows the size
>> +         of the object as if the identities recorded in it were replaced
>> +         by the mailmap mechanism.
> 
> Same remark about the `info` command as above.
> 
> As the `--batch-check` option prints only object information (which
> includes the size), I think something like the following should be
> used here:
> 
>         * When used with `--use-mailmap`, for commit and tag objects, the
>            printed object information shows the size of the object as if the
>            identities recorded in it were replaced by the mailmap mechanism.
> 
>>   --batch-command::
>>   --batch-command=<format>::
>>          Enter a command mode that reads commands and arguments from stdin. May
>> -       only be combined with `--buffer`, `--textconv` or `--filters`. In the
>> -       case of `--textconv` or `--filters`, the input lines also need to specify
>> -       the path, separated by whitespace. See the section `BATCH OUTPUT` below
>> -       for details.
>> +       only be combined with `--buffer`, `--textconv`, `--use-mailmap` or
>> +       `--filters`.
>> +       +
>> +       * When used with `--textconv` or `--filters`, the input lines must
>> +         specify the path, separated by whitespace. See the section
>> +         `BATCH OUTPUT` below for details.
>> +       +
>> +       * When used with `--use-mailmap`, the info command shows the size
>> +         of the object as if the identities recorded in it were replaced
>> +         by the mailmap mechanism.
> 
> s/info command/`info` command/
> 
> And I think it could be interesting to add:
> 
>    - that it happens only for commits and tags, and
>    - that when the `contents` command is used the idents are replaced.
> 
> So maybe something like:
> 
>         * When used with `--use-mailmap`, for commit and tag objects, the
>           `contents` command shows the identities replaced using the
>            mailmap mechanism, while the `info` command shows the size
>            of the object as if it actually recorded the replacement
>            identities.
> 
> Also this will become true only after your other patch series will be
> merged. Which means that you should say somewhere that either
> 
>    - this patch should be merged only after the other patch series is merged, or
>    - it's a bug that the `info` command doesn't show the size of the
> updated object and this is going to be fixed soon by the other patch
> series anyway.
> 
> Thanks for working on finishing this!
> Christian.

Thanks a ton for the review Christian :) Will make the suggested changes 
and send the v4 patch series.
diff mbox series

Patch

diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index ec30b5c574..db2bba9b65 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -89,26 +89,45 @@  OPTIONS
 --batch::
 --batch=<format>::
 	Print object information and contents for each object provided
-	on stdin.  May not be combined with any other options or arguments
-	except `--textconv` or `--filters`, in which case the input lines
-	also need to specify the path, separated by whitespace.  See the
-	section `BATCH OUTPUT` below for details.
+	on stdin. May not be combined with any other options or arguments
+	except --textconv, --filters, or --use-mailmap.
+	+
+	* When used with `--textconv` or `--filters`, the input lines
+	  must specify the path, separated by whitespace. See the section
+	  `BATCH OUTPUT` below for details.
+	+
+	* When used with `--use-mailmap`, the info command shows the size
+	  of the object as if the identities recorded in it were replaced
+	  by the mailmap mechanism.
 
 --batch-check::
 --batch-check=<format>::
-	Print object information for each object provided on stdin.  May
-	not be combined with any other options or arguments except
-	`--textconv` or `--filters`, in which case the input lines also
-	need to specify the path, separated by whitespace.  See the
-	section `BATCH OUTPUT` below for details.
+	Print object information for each object provided on stdin. May not be
+	combined with any other options or arguments except --textconv, --filters
+	or --use-mailmap.
+	+
+	* When used with `--textconv` or `--filters`, the input lines must
+	 specify the path, separated by whitespace. See the section
+	 `BATCH OUTPUT` below for details.
+	+
+	* When used with `--use-mailmap`, the info command shows the size
+	  of the object as if the identities recorded in it were replaced
+	  by the mailmap mechanism.
 
 --batch-command::
 --batch-command=<format>::
 	Enter a command mode that reads commands and arguments from stdin. May
-	only be combined with `--buffer`, `--textconv` or `--filters`. In the
-	case of `--textconv` or `--filters`, the input lines also need to specify
-	the path, separated by whitespace. See the section `BATCH OUTPUT` below
-	for details.
+	only be combined with `--buffer`, `--textconv`, `--use-mailmap` or
+	`--filters`.
+	+
+	* When used with `--textconv` or `--filters`, the input lines must
+	  specify the path, separated by whitespace. See the section
+	  `BATCH OUTPUT` below for details.
+	+
+	* When used with `--use-mailmap`, the info command shows the size
+	  of the object as if the identities recorded in it were replaced
+	  by the mailmap mechanism.
+
 +
 `--batch-command` recognizes the following commands:
 +