All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] archive: rewrite description for compression level option
@ 2021-10-15 12:13 Bagas Sanjaya
  2021-10-15 12:46 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 4+ messages in thread
From: Bagas Sanjaya @ 2021-10-15 12:13 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	vagabon.xyz, Jeff King, René Scharfe, Bagas Sanjaya

Rewrite the description of `-#` option. Since the option is also
supported on tar archive, move to OPTIONS section and remove EXTRA.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Changes since v1 [1]:
     - Mention common levels (store-only, fastest time, and best
       compression).
     - Note that compression level option is supported by both zip and
       tar format, so move the description to OPTIONS section.

 [1]: https://lore.kernel.org/git/xmqqpms6akup.fsf@gitster.g/T/#t

 Documentation/git-archive.txt | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index 9f8172828d..9aecc0936c 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -9,7 +9,7 @@ git-archive - Create an archive of files from a named tree
 SYNOPSIS
 --------
 [verse]
-'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
+'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [-#]
 	      [-o <file> | --output=<file>] [--worktree-attributes]
 	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
 	      [<path>...]
@@ -65,10 +65,6 @@ OPTIONS
 	Look for attributes in .gitattributes files in the working tree
 	as well (see <<ATTRIBUTES>>).
 
-<extra>::
-	This can be any options that the archiver backend understands.
-	See next section.
-
 --remote=<repo>::
 	Instead of making a tar archive from the local repository,
 	retrieve a tar archive from a remote repository. Note that the
@@ -88,17 +84,13 @@ OPTIONS
 	of the current working directory are included in the archive.
 	If one or more paths are specified, only these are included.
 
-BACKEND EXTRA OPTIONS
----------------------
-
-zip
-~~~
--0::
-	Store the files instead of deflating them.
--9::
-	Highest and slowest compression level.  You can specify any
-	number from 1 to 9 to adjust compression speed and ratio.
-
+-#::
+	Select the compression level. The supported levels and default
+	value (if none is selected) are depending on compression command
+	backend configured for the selected format (either explicitly with
+	`--format` or inferred from file name specified with `-o`). Common
+	values are `-0` for only storing files (zip only), `-1` for fastest
+	compression time, and `-9` for best compression ratio.
 
 CONFIGURATION
 -------------

base-commit: 2bd2f258f4195ac54293a3f45b86457c0bd5fc11
-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] archive: rewrite description for compression level option
  2021-10-15 12:13 [PATCH v2] archive: rewrite description for compression level option Bagas Sanjaya
@ 2021-10-15 12:46 ` Ævar Arnfjörð Bjarmason
  2021-10-15 16:50   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-10-15 12:46 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: git, Junio C Hamano, vagabon.xyz, Jeff King, René Scharfe


On Fri, Oct 15 2021, Bagas Sanjaya wrote:

> Rewrite the description of `-#` option. Since the option is also
> supported on tar archive, move to OPTIONS section and remove EXTRA.
>
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  Changes since v1 [1]:
>      - Mention common levels (store-only, fastest time, and best
>        compression).
>      - Note that compression level option is supported by both zip and
>        tar format, so move the description to OPTIONS section.
>
>  [1]: https://lore.kernel.org/git/xmqqpms6akup.fsf@gitster.g/T/#t
>
>  Documentation/git-archive.txt | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
> index 9f8172828d..9aecc0936c 100644
> --- a/Documentation/git-archive.txt
> +++ b/Documentation/git-archive.txt
> @@ -9,7 +9,7 @@ git-archive - Create an archive of files from a named tree
>  SYNOPSIS
>  --------
>  [verse]
> -'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
> +'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [-#]
>  	      [-o <file> | --output=<file>] [--worktree-attributes]
>  	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
>  	      [<path>...]
> @@ -65,10 +65,6 @@ OPTIONS
>  	Look for attributes in .gitattributes files in the working tree
>  	as well (see <<ATTRIBUTES>>).
>  
> -<extra>::
> -	This can be any options that the archiver backend understands.
> -	See next section.
> -
>  --remote=<repo>::
>  	Instead of making a tar archive from the local repository,
>  	retrieve a tar archive from a remote repository. Note that the
> @@ -88,17 +84,13 @@ OPTIONS
>  	of the current working directory are included in the archive.
>  	If one or more paths are specified, only these are included.
>  
> -BACKEND EXTRA OPTIONS
> ----------------------
> -
> -zip
> -~~~
> --0::
> -	Store the files instead of deflating them.
> --9::
> -	Highest and slowest compression level.  You can specify any
> -	number from 1 to 9 to adjust compression speed and ratio.
> -
> +-#::
> +	Select the compression level. The supported levels and default
> +	value (if none is selected) are depending on compression command
> +	backend configured for the selected format (either explicitly with
> +	`--format` or inferred from file name specified with `-o`). Common
> +	values are `-0` for only storing files (zip only), `-1` for fastest
> +	compression time, and `-9` for best compression ratio.


This is getting there, but I think we really should not have a -# in the
synopsis, since that's not how we refer to a digit-wildcard in any other
context. And users might assume that a literal -# is meant, some
commonly used tools even support that, e.g. try:

    curl -L -o /dev/null -# https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-11.1.0-amd64-DVD-1.iso

Let's just use "[-<0..9 digit>[", or "[-<digit>]" in the SYNOPSIS and
explain that it's 0..9 below in this section..

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] archive: rewrite description for compression level option
  2021-10-15 12:46 ` Ævar Arnfjörð Bjarmason
@ 2021-10-15 16:50   ` Junio C Hamano
  2021-10-16  5:19     ` Bagas Sanjaya
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2021-10-15 16:50 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Bagas Sanjaya, git, vagabon.xyz, Jeff King, René Scharfe

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

>>  SYNOPSIS
>>  --------
>>  [verse]
>> -'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
>> +'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [-#]
>>  	      [-o <file> | --output=<file>] [--worktree-attributes]
>>  	      [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
>>  	      [<path>...]
>> @@ -65,10 +65,6 @@ OPTIONS
>>  	Look for attributes in .gitattributes files in the working tree
>>  	as well (see <<ATTRIBUTES>>).
>>  
>> -<extra>::
>> -	This can be any options that the archiver backend understands.
>> -	See next section.
>> -
>>  --remote=<repo>::
>>  	Instead of making a tar archive from the local repository,
>>  	retrieve a tar archive from a remote repository. Note that the
>> @@ -88,17 +84,13 @@ OPTIONS
>>  	of the current working directory are included in the archive.
>>  	If one or more paths are specified, only these are included.
>>  
>> -BACKEND EXTRA OPTIONS
>> ----------------------
>> -
>> -zip
>> -~~~
>> --0::
>> -	Store the files instead of deflating them.
>> --9::
>> -	Highest and slowest compression level.  You can specify any
>> -	number from 1 to 9 to adjust compression speed and ratio.
>> -
>> +-#::
>> +	Select the compression level. The supported levels and default
>> +	value (if none is selected) are depending on compression command
>> +	backend configured for the selected format (either explicitly with
>> +	`--format` or inferred from file name specified with `-o`). Common
>> +	values are `-0` for only storing files (zip only), `-1` for fastest
>> +	compression time, and `-9` for best compression ratio.
>
>
> This is getting there, but I think we really should not have a -# in the
> synopsis, since that's not how we refer to a digit-wildcard in any other
> context. And users might assume that a literal -# is meant, some
> commonly used tools even support that, e.g. try:
>
>     curl -L -o /dev/null -# https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/debian-11.1.0-amd64-DVD-1.iso
>
> Let's just use "[-<0..9 digit>[", or "[-<digit>]" in the SYNOPSIS and
> explain that it's 0..9 below in this section..

I agree with you about `-#`.

I do not think it is a good idea to remove the backend-specific
option section like this patch does, as the next archiver may not
even support `-<digit>`.  Even with the existing two backends, the
description of it need to be different (cf. the other response I
sent you last night on "--fast/--best"?).  Rather, the first thing
to improve would be to _add_ a section for `tar` format, next to the
`zip` format, I would think, as those who wants to write `tar` do
not have to read `zip` specific options, and vice versa.

The new paragraph on `-#` in the patch may work as a replacement for
existing explanation for `zip`-specific extra options, but it needs
to drop the changes made to make it applicable to any format, like
"depending on ... backend" and "(zip only)" if we want to take it.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] archive: rewrite description for compression level option
  2021-10-15 16:50   ` Junio C Hamano
@ 2021-10-16  5:19     ` Bagas Sanjaya
  0 siblings, 0 replies; 4+ messages in thread
From: Bagas Sanjaya @ 2021-10-16  5:19 UTC (permalink / raw)
  To: Junio C Hamano, Ævar Arnfjörð Bjarmason
  Cc: git, vagabon.xyz, Jeff King, René Scharfe

On 15/10/21 23.50, Junio C Hamano wrote:
> I do not think it is a good idea to remove the backend-specific
> option section like this patch does, as the next archiver may not
> even support `-<digit>`.  Even with the existing two backends, the
> description of it need to be different (cf. the other response I
> sent you last night on "--fast/--best"?).  Rather, the first thing
> to improve would be to _add_ a section for `tar` format, next to the
> `zip` format, I would think, as those who wants to write `tar` do
> not have to read `zip` specific options, and vice versa.
> 
> The new paragraph on `-#` in the patch may work as a replacement for
> existing explanation for `zip`-specific extra options, but it needs
> to drop the changes made to make it applicable to any format, like
> "depending on ... backend" and "(zip only)" if we want to take it.

In current situation, both zip and tar backend supports the compression 
level option, so it will end up duplicating description of the option 
for both backends (with slight differences).

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-16  5:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 12:13 [PATCH v2] archive: rewrite description for compression level option Bagas Sanjaya
2021-10-15 12:46 ` Ævar Arnfjörð Bjarmason
2021-10-15 16:50   ` Junio C Hamano
2021-10-16  5:19     ` Bagas Sanjaya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.