threads / patch / 39899

patch, 3 partsdoc: convert send-email option headings to nouns

Subject: [PATCH 1/3] doc: convert send-email option headings to nouns

## tl;dr

18 messages between Jul 20, 2015 and Jul 22, 2015. Diffs are folded; open one to read it.

replies: 17people: 3as markdown or json

Philip Oakley· Jul 20, 2015, 18:26 UTC · lore

[PATCH 0/3] Update send-email cc-cmd documentation

This mini series updates captures the details of how to use the cc-cmd option of send-email, following my abortive attempts to use a simple 'cat cc-cmd' invocation.

The alternative text for 'auto-cc' has been somewhat guesses at.
I haven't tested how well it lays out when docbook'ed.
The series could be squashed together..
Philip Oakley (3):
  doc: convert send-email option headings to nouns
  doc: send-email; expand on the meaning of 'auto-cc'
  doc: give examples for send-email cc-cmd operation
 Documentation/git-send-email.txt | 54 +++++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 9 deletions(-)
-- 
2.4.2.windows.1.5.gd32afb6
Philip Oakley· Jul 20, 2015, 18:26 UTC · re: Philip Oakley · lore
... for ease of reference within the text.

Except the 'Sending options' for which there wasn't an obvious noun phrase.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 Documentation/git-send-email.txt | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Show changes to Documentation/git-send-email.txt +8 −8
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 7ae467b..bc357b8 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -41,8 +41,8 @@ and the "Subject:" of the message as the second line.
 OPTIONS
 -------
 
-Composing
-~~~~~~~~~
+Composition options
+~~~~~~~~~~~~~~~~~~~
 
 --annotate::
 	Review and edit each patch you're about to send. Default is the value
@@ -147,8 +147,8 @@ Note that no attempts whatsoever are made to validate the encoding.
 	the header is added, but it can be turned off by setting the
 	`sendemail.xmailer` configuration variable to `false`.
 
-Sending
-~~~~~~~
+Sending options
+~~~~~~~~~~~~~~~
 
 --envelope-sender=<address>::
 	Specify the envelope sender used to send the emails.
@@ -234,8 +234,8 @@ must be used for each option.
 	commands and replies will be printed. Useful to debug TLS
 	connection and authentication problems.
 
-Automating
-~~~~~~~~~~
+Automation options
+~~~~~~~~~~~~~~~~~~
 
 --to-cmd=<command>::
 	Specify a command to execute once per patch file which
@@ -326,8 +326,8 @@ Failure to do so may not produce the expected result in the
 recipient's MUA.
 
 
-Administering
-~~~~~~~~~~~~~
+Administration options
+~~~~~~~~~~~~~~~~~~~~~~
 
 --confirm=<mode>::
 	Confirm just before sending:
-- 
2.4.2.windows.1.5.gd32afb6
Philip Oakley· Jul 20, 2015, 18:26 UTC · re: Philip Oakley · lore

[PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc'

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 Documentation/git-send-email.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to Documentation/git-send-email.txt +1 −1
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index bc357b8..ddc8a11 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -282,7 +282,7 @@ Automation options
 
 --suppress-cc=<category>::
 	Specify an additional category of recipients to suppress the
-	auto-cc of:
+	inclusion of addresses added via other automation options:
 +
 --
 - 'author' will avoid including the patch author
-- 
2.4.2.windows.1.5.gd32afb6
Eric Sunshine· Jul 20, 2015, 18:34 UTC · re: Philip Oakley · lore

Re: [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc'

On Mon, Jul 20, 2015 at 2:26 PM, Philip Oakley <philipoakley@iee.org> wrote:
> doc: send-email; expand on the meaning of 'auto-cc'
s/;/:/
Show 17 quoted lines
> Signed-off-by: Philip Oakley <philipoakley@iee.org>
> ---
> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
> index bc357b8..ddc8a11 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -282,7 +282,7 @@ Automation options
>
>  --suppress-cc=<category>::
>         Specify an additional category of recipients to suppress the
> -       auto-cc of:
> +       inclusion of addresses added via other automation options:
>  +
>  --
>  - 'author' will avoid including the patch author
> --
> 2.4.2.windows.1.5.gd32afb6
Philip Oakley· Jul 20, 2015, 18:26 UTC · re: Philip Oakley · lore

[PATCH 2/3] doc: send-email; expand oon the meaning of 'auto-cc'

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 Documentation/git-send-email.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to Documentation/git-send-email.txt +1 −1
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index bc357b8..ddc8a11 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -282,7 +282,7 @@ Automation options
 
 --suppress-cc=<category>::
 	Specify an additional category of recipients to suppress the
-	auto-cc of:
+	inclusion of addresses added via other automation options:
 +
 --
 - 'author' will avoid including the patch author
-- 
2.4.2.windows.1.5.gd32afb6
Philip Oakley· Jul 20, 2015, 18:55 UTC · re: Philip Oakley · lore

Re: [PATCH 2/3] doc: send-email; expand oon the meaning of 'auto-cc'

This one, with "oon" in the subject, is incorrect.

I made the same mistake yesterday, thinking that a fresh format-patch had/would over-write the previous patches, but I'd forgot, again, that the filename uses the subject line, so send-email picked up both versions .. doh.

Sorry for the noise. ----- Original Message -----

Show 7 quoted lines
> From: "Philip Oakley" <philipoakley@iee.org>
> To: "Git List" <git@vger.kernel.org>
> Cc: "Junio C Hamano" <gitster@pobox.com>; "Eric Sunshine" 
> <sunshine@sunshineco.com>
> Sent: Monday, July 20, 2015 7:26 PM
> Subject: [PATCH 2/3] doc: send-email; expand oon the meaning of 
> 'auto-cc'
Philip Oakley· Jul 20, 2015, 18:26 UTC · re: Philip Oakley · lore

[PATCH 3/3] doc: give examples for send-email cc-cmd operation

Explain how the cc-cmd (and to-cmd) is invoked, along with two simple examples (and a how-not-to example) to help in getting started.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
http://article.gmane.org/gmane.comp.version-control.git/274302
---
 Documentation/git-send-email.txt | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
Show changes to Documentation/git-send-email.txt +36 −0
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ddc8a11..9f991cf 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -436,6 +436,42 @@ following commands:
 Note: the following perl modules are required
       Net::SMTP::SSL, MIME::Base64 and Authen::SASL
 
+Creating a cc-cmd (and to-cmd) action
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+git-send-email invokes the cc-cmd like this:
+
+	$cc-cmd $patchfilename
+
+Thus the patch itself can be processed to locate appropriate email address
+information if required.
+
+A simple solution for a basic address list is to create a 'cc-cmd' file
+(executable) which provides a list of addressees:
+
+	#!/bin/sh
+	echo <<\EOF
+	person1@example.com
+	person2@example.com
+	EOF
+
+Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text file
+of email addresses), does not work as expected as the invocation becomes:
+
+	$cat cc-cmd $patchfilename
+
+and since 'cat' copies the concatenation of its input files to its output,
+this adds the patch file to the address list resulting in an error
+"unable to extract a valid address from:".
+
+The quick-and-dirty work-around is to use '#' to effectively comment out
+the patch file name:
+
+    --cc-cmd='cat cc-cmd #'
+
+which works, but is very, very ugly.
+
+
 SEE ALSO
 --------
 linkgit:git-format-patch[1], linkgit:git-imap-send[1], mbox(5)
-- 
2.4.2.windows.1.5.gd32afb6
Eric Sunshine· Jul 20, 2015, 18:50 UTC · re: Philip Oakley · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

On Mon, Jul 20, 2015 at 2:26 PM, Philip Oakley <philipoakley@iee.org> wrote:
Show 26 quoted lines
> Explain how the cc-cmd (and to-cmd) is invoked, along with two
> simple examples (and a how-not-to example) to help in getting started.
>
> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
> Signed-off-by: Philip Oakley <philipoakley@iee.org>
> ---
> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
> index ddc8a11..9f991cf 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -436,6 +436,42 @@ following commands:
>  Note: the following perl modules are required
>        Net::SMTP::SSL, MIME::Base64 and Authen::SASL
>
> +Creating a cc-cmd (and to-cmd) action
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +git-send-email invokes the cc-cmd like this:
> +
> +       $cc-cmd $patchfilename
> +
> +Thus the patch itself can be processed to locate appropriate email address
> +information if required.
> +
> +A simple solution for a basic address list is to create a 'cc-cmd' file
> +(executable) which provides a list of addressees:

Rather than calling this a "simple solution", you might instead say that this is an example of a bare-bones script which just returns a fixed list of email addresses without attempting to extract any addresses from the patch file itself.

Show 5 quoted lines
> +       #!/bin/sh
> +       echo <<\EOF
> +       person1@example.com
> +       person2@example.com
> +       EOF

I don't know if it deserves mention that the script must be executable (chmod +x) or should we assume that readers are smart enough to understand this implicitly? (It probably should be mentioned.)

Other than those minor points, the above looks fine, however...
Show 15 quoted lines
> +Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text file
> +of email addresses), does not work as expected as the invocation becomes:
> +
> +       $cat cc-cmd $patchfilename
> +
> +and since 'cat' copies the concatenation of its input files to its output,
> +this adds the patch file to the address list resulting in an error
> +"unable to extract a valid address from:".
> +
> +The quick-and-dirty work-around is to use '#' to effectively comment out
> +the patch file name:
> +
> +    --cc-cmd='cat cc-cmd #'
> +
> +which works, but is very, very ugly.

This entire above text about "cat $addressfile" seems awfully inappropriate for a manual page, especially the bit about the terrible "cat $file #" hack.

Show 6 quoted lines
>  SEE ALSO
>  --------
>  linkgit:git-format-patch[1], linkgit:git-imap-send[1], mbox(5)
> --
> 2.4.2.windows.1.5.gd32afb6
>
Eric Sunshine· Jul 20, 2015, 19:14 UTC · re: Eric Sunshine · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

On Mon, Jul 20, 2015 at 2:50 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 26 quoted lines
> On Mon, Jul 20, 2015 at 2:26 PM, Philip Oakley <philipoakley@iee.org> wrote:
>> Explain how the cc-cmd (and to-cmd) is invoked, along with two
>> simple examples (and a how-not-to example) to help in getting started.
>>
>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
>> Signed-off-by: Philip Oakley <philipoakley@iee.org>
>> ---
>> +Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text file
>> +of email addresses), does not work as expected as the invocation becomes:
>> +
>> +       $cat cc-cmd $patchfilename
>> +
>> +and since 'cat' copies the concatenation of its input files to its output,
>> +this adds the patch file to the address list resulting in an error
>> +"unable to extract a valid address from:".
>> +
>> +The quick-and-dirty work-around is to use '#' to effectively comment out
>> +the patch file name:
>> +
>> +    --cc-cmd='cat cc-cmd #'
>> +
>> +which works, but is very, very ugly.
>
> This entire above text about "cat $addressfile" seems awfully
> inappropriate for a manual page, especially the bit about the terrible
> "cat $file #" hack.

If you really want to give an example of how to use --cc-cmd (--to-cmd) with a plain text file holding email addresses, maybe something like this instead:

Create an EXAMPLES section.
Make the bare-bones, static address list script the first example:
    #!/bin/sh
    echo <<\EOF
    person1@example.com
    person2@example.com
    EOF

Then add an example showing how to take the fixed address list from a plain text file. Have the user create the following script (let's call it "anticat") which cat's all of its input arguments except the final one, which is the patch itself:

    #!/bin/sh
    while test $# -gt 1
    do
        cat $1
        shift
    done
And, to use: --to-cccmd='anticat myaddresses.txt'
Eric Sunshine· Jul 20, 2015, 20:26 UTC · re: Eric Sunshine · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

On Mon, Jul 20, 2015 at 3:14 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 27 quoted lines
> If you really want to give an example of how to use --cc-cmd
> (--to-cmd) with a plain text file holding email addresses, maybe
> something like this instead:
>
> Create an EXAMPLES section.
>
> Make the bare-bones, static address list script the first example:
>
>     #!/bin/sh
>     echo <<\EOF
>     person1@example.com
>     person2@example.com
>     EOF
>
> Then add an example showing how to take the fixed address list from a
> plain text file. Have the user create the following script (let's call
> it "anticat") which cat's all of its input arguments except the final
> one, which is the patch itself:
>
>     #!/bin/sh
>     while test $# -gt 1
>     do
>         cat $1
>         shift
>     done
>
> And, to use: --to-cccmd='anticat myaddresses.txt'

I forgot to add that even this is iffy as an example because it depends upon the current implementation passing the cmd string to a shell, which might not always be the case, and might not be reliably implemented that way on some platforms (such as Windows).

Philip Oakley· Jul 20, 2015, 19:36 UTC · re: Eric Sunshine · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

From: "Eric Sunshine" <sunshine@sunshineco.com>
Show 47 quoted lines
> On Mon, Jul 20, 2015 at 2:26 PM, Philip Oakley <philipoakley@iee.org> 
> wrote:
>> Explain how the cc-cmd (and to-cmd) is invoked, along with two
>> simple examples (and a how-not-to example) to help in getting 
>> started.
>>
>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
>> Signed-off-by: Philip Oakley <philipoakley@iee.org>
>> ---
>> diff --git a/Documentation/git-send-email.txt 
>> b/Documentation/git-send-email.txt
>> index ddc8a11..9f991cf 100644
>> --- a/Documentation/git-send-email.txt
>> +++ b/Documentation/git-send-email.txt
>> @@ -436,6 +436,42 @@ following commands:
>>  Note: the following perl modules are required
>>        Net::SMTP::SSL, MIME::Base64 and Authen::SASL
>>
>> +Creating a cc-cmd (and to-cmd) action
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +git-send-email invokes the cc-cmd like this:
>> +
>> +       $cc-cmd $patchfilename
>> +
>> +Thus the patch itself can be processed to locate appropriate email 
>> address
>> +information if required.
>> +
>> +A simple solution for a basic address list is to create a 'cc-cmd' 
>> file
>> +(executable) which provides a list of addressees:
>
> Rather than calling this a "simple solution", you might instead say
> that this is an example of a bare-bones script which just returns a
> fixed list of email addresses without attempting to extract any
> addresses from the patch file itself.
>
>> +       #!/bin/sh
>> +       echo <<\EOF
>> +       person1@example.com
>> +       person2@example.com
>> +       EOF
>
> I don't know if it deserves mention that the script must be executable
> (chmod +x) or should we assume that readers are smart enough to
> understand this implicitly? (It probably should be mentioned.)

It's there, but it's after the wrap-around. Maybe s/(executable)/(must be executable: `chmod +x`)/ to be fully pedantic.

Show 26 quoted lines
>
> Other than those minor points, the above looks fine, however...
>
>> +Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text 
>> file
>> +of email addresses), does not work as expected as the invocation 
>> becomes:
>> +
>> +       $cat cc-cmd $patchfilename
>> +
>> +and since 'cat' copies the concatenation of its input files to its 
>> output,
>> +this adds the patch file to the address list resulting in an error
>> +"unable to extract a valid address from:".
>> +
>> +The quick-and-dirty work-around is to use '#' to effectively comment 
>> out
>> +the patch file name:
>> +
>> +    --cc-cmd='cat cc-cmd #'
>> +
>> +which works, but is very, very ugly.
>
> This entire above text about "cat $addressfile" seems awfully
> inappropriate for a manual page, especially the bit about the terrible
> "cat $file #" hack.

Given that this invocation is why this all kicked off ... 'cat list.txt', being the most simple of commands and a first cargo-cult try for many, I definitely think it's worthwhile including somehow.

Perhaps one needs to be more direct with the right invocation.

"A simple `--cc-cmd='cat list.txt #'` is a quick-and-dirty way of using an address list, while ignoring the patch content."

Show 12 quoted lines
>
>>  SEE ALSO
>>  --------
>>  linkgit:git-format-patch[1], linkgit:git-imap-send[1], mbox(5)
>> --
>> 2.4.2.windows.1.5.gd32afb6
>>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Eric Sunshine· Jul 20, 2015, 20:36 UTC · re: Philip Oakley · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

On Mon, Jul 20, 2015 at 3:36 PM, Philip Oakley <philipoakley@iee.org> wrote:
Show 13 quoted lines
> From: "Eric Sunshine" <sunshine@sunshineco.com>
>>> +       echo <<\EOF
>>> +       person1@example.com
>>> +       person2@example.com
>>> +       EOF
>>
>> I don't know if it deserves mention that the script must be executable
>> (chmod +x) or should we assume that readers are smart enough to
>> understand this implicitly? (It probably should be mentioned.)
>
> It's there, but it's after the wrap-around. Maybe
> s/(executable)/(must be executable: `chmod +x`)/
> to be fully pedantic.

I did see the "(executable)", but wasn't sure if it meant executable in the 'chmod +x' sense or executable as another name for "program".

Show 12 quoted lines
>> This entire above text about "cat $addressfile" seems awfully
>> inappropriate for a manual page, especially the bit about the terrible
>> "cat $file #" hack.
>
> Given that this invocation is why this all kicked off ...
> 'cat list.txt', being the most simple of commands and a first cargo-cult try
> for many, I definitely think it's worthwhile including somehow.
>
> Perhaps one needs to be more direct with the right invocation.
>
> "A simple `--cc-cmd='cat list.txt #'` is a quick-and-dirty way of using an
> address list, while ignoring the patch content."

It seems utterly sinful to promulgate this sort of hack to a wider audience. If reading addresses from a file is likely to be a common need, then perhaps it ought to have direct support in git-send-email (via a new command-line option or something).

Also, this all may be moot once rl/send-email-aliases[1] lands in a release since users will then be able to say:

    --cc="$(cat recipients.txt)"

provided that the email addresses in recipients.txt are comma-separated and a POSIX-like shell is being used. Perhaps that deserves an example in the documentation?

[1]: b1c8a11 (send-email: allow multiple emails using --cc, --to and --bcc, 2015-06-30)

Junio C Hamano· Jul 20, 2015, 19:59 UTC · re: Philip Oakley · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

Philip Oakley <philipoakley@iee.org> writes:
Show 6 quoted lines
> +git-send-email invokes the cc-cmd like this:
> +
> +	$cc-cmd $patchfilename
> +
> +Thus the patch itself can be processed to locate appropriate email address
> +information if required.

That's not even a valid command line (cc-cmd cannot be a shell variable name), so why bother writing it that way? Rather

    The program that is specified by `cc-cmd` is invoked by `git
    send-email` with the name of the patch file as an argument;
    the program can read from it and customize its output based on
    what the patch file contains.
    
or something like that, perhaps.
> +
> +A simple solution for a basic address list is to create a 'cc-cmd' file
> +(executable) which provides a list of addressees:

There is no "problem" stated here that requires your "solution". In fact, what problem are you solving?

Show 5 quoted lines
> +	#!/bin/sh
> +	echo <<\EOF
> +	person1@example.com
> +	person2@example.com
> +	EOF

That is one simple and denegerate use case; if the program does not need any information from the patch file, it surely has an option not to look at it. But it is not an interesting usage.

If you want to add a single example to illustrate how cc-cmd (or to-cmd, or anything that goes thru recipients_cmd()), you should have an example that reads the input and then adds a few hardcoded one.

	#!/bin/sh
	# always send it to the logger service
        echo "patchlog@example.com"
	# tell the bug tracker as necessary
	if fixes=$(sed -ne 's/^Fixes bug#\([0-9]*\)/\1/p' "$1")
        then
		echo "bugs+$fixes@example.com"
	fi
or something silly like that.
And this ...
Show 5 quoted lines
> +Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text file
> +of email addresses), does not work as expected as the invocation becomes:
> +
> +	$cat cc-cmd $patchfilename
> +

... and the rest of the patch is unnecessary noise to a reader who read that the single argument to the program is the name of the patchfile, I think. You were trying to avoid the same confusion caused by the sketchy documentaiton, and you already "solved" that problem by telling the reader what the command takes as its input.

> +    --cc-cmd='cat cc-cmd #'

This heavily depends on the current implementation that happens to pass the command line string to a shell.

Philip Oakley· Jul 20, 2015, 21:35 UTC · re: Junio C Hamano · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

From: "Junio C Hamano" <gitster@pobox.com>
Show 12 quoted lines
> Philip Oakley <philipoakley@iee.org> writes:
>
>> +git-send-email invokes the cc-cmd like this:
>> +
>> + $cc-cmd $patchfilename
>> +
>> +Thus the patch itself can be processed to locate appropriate email 
>> address
>> +information if required.
>
> That's not even a valid command line (cc-cmd cannot be a shell
> variable name), so why bother writing it that way?  Rather
We seem to be going round in circles.
Currently the --cc-cmd isn't well documented.

I was trying to use, essentially, 'cat list.txt' as the command, which should work according to the current doc, which says nothing about how/if the patch file is to be passed to the command.

Eric was able to make clear (*) that the code https://github.com/git/git/blob/master/git-send-email.perl#L1602 does essentially execute '$cc-cmd $patchfilename' where $cc-cmd is the value of the --cc-cmd option.

This meant that my plain vanilla 'cat list.txt' command errored out.

The question are: What should the "command" look like. (can it be a command, or does it have to be a script??) How should the patch/patchfile be passed - what should the documentation guarantee?

At the moment it's the perl code that defines execution of the rather flexible '$cc-cmd $patchfilename' command. (i.e. anything could be in the $cc-cmd string)

Show 15 quoted lines
>
>    The program that is specified by `cc-cmd` is invoked by `git
>    send-email` with the name of the patch file as an argument;
>    the program can read from it and customize its output based on
>    what the patch file contains.
>
> or something like that, perhaps.
>
>> +
>> +A simple solution for a basic address list is to create a 'cc-cmd' 
>> file
>> +(executable) which provides a list of addressees:
>
> There is no "problem" stated here that requires your "solution".  In
> fact, what problem are you solving?

As noted above, it's so that I can state a direct command as the --cc-cmd, so that a plain text file listing cc addresses is offered to send-email, without needing to create a script.

Show 41 quoted lines
>
>> + #!/bin/sh
>> + echo <<\EOF
>> + person1@example.com
>> + person2@example.com
>> + EOF
>
> That is one simple and denegerate use case; if the program does not
> need any information from the patch file, it surely has an option
> not to look at it.  But it is not an interesting usage.
>
> If you want to add a single example to illustrate how cc-cmd (or
> to-cmd, or anything that goes thru recipients_cmd()), you should
> have an example that reads the input and then adds a few hardcoded
> one.
>
> #!/bin/sh
> # always send it to the logger service
>        echo "patchlog@example.com"
> # tell the bug tracker as necessary
> if fixes=$(sed -ne 's/^Fixes bug#\([0-9]*\)/\1/p' "$1")
>        then
> echo "bugs+$fixes@example.com"
> fi
>
> or something silly like that.
>
> And this ...
>
>> +Simply, using `cat cc-cmd` as the --cc-cmd (with cc-cmd as the text 
>> file
>> +of email addresses), does not work as expected as the invocation 
>> becomes:
>> +
>> + $cat cc-cmd $patchfilename
>> +
>
> ... and the rest of the patch is unnecessary noise to a reader who
> read that the single argument to the program is the name of the
> patchfile, I think.  You were trying to avoid the same confusion
> caused by the sketchy documentaiton, and you already "solved" that

I'm not so sure that all other readers would 'know' what went wrong if they tried the same as I, without going through the same Q&A, hence the desire to inform.

Show 6 quoted lines
> problem by telling the reader what the command takes as its input.
>
>> +    --cc-cmd='cat cc-cmd #'
>
> This heavily depends on the current implementation that happens to
> pass the command line string to a shell.

Not sure what effective alternative is being suggested - if its a shell script, it'll still hit the shell.

>

-- Philip

Junio C Hamano· Jul 20, 2015, 22:37 UTC · re: Philip Oakley · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

"Philip Oakley" <philipoakley@iee.org> writes:
> We seem to be going round in circles.
I do not think so.
> Currently the --cc-cmd isn't well documented.
Yes, I agree.
> I was trying to use, essentially, 'cat list.txt' as the command, which
> should work according to the current doc, which says nothing about
> how/if the patch file is to be passed to the command.

I've already agreed in the message you are responding to that the current documentation is sketchy and invite mistakes like yours. And that is why this series exists, isn't it?

Show 5 quoted lines
> The question are:
> What should the "command" look like. (can it be a command, or does it
> have to be a script??)
> How should the patch/patchfile be passed - what should the
> documentation guarantee?
Yes, I think I already answered that, no?
Show 6 quoted lines
>>    The program that is specified by `cc-cmd` is invoked by `git
>>    send-email` with the name of the patch file as an argument;
>>    the program can read from it and customize its output based on
>>    what the patch file contains.
>>
>> or something like that, perhaps.

We do not care if that program is scripted, or written in java and compiled. It will find the patch in argv[1]. It is up to the program if it uses that input to customize its output, or it just outputs a hardcoded list of addresses.

That is the only guarantee we would want to give.
Junio C Hamano· Jul 20, 2015, 22:59 UTC · re: Junio C Hamano · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

Junio C Hamano <gitster@pobox.com> writes:
>> I was trying to use, essentially, 'cat list.txt' as the command,...

One thing that needs to be made clear is that I do not think we want to encourage `cat list.txt #` abuse in the first place. It is an unacceptable hack for us to encourage in the longer term. It may happen to work with the current implementation, but it does so merely by depending on the implementation too much.

If it is so common to want to spray all your patches to exactly the same list of recipients that is unconditionally determined, having multiple sendemail.cc configuration variables, which are cumulative, is already one way to do so, and you do not have to type such a long option "--cc-cmd='cat $filename'" every time.

And if you do not want configuration for some reason, and having a list of addresses in a flat file is so common, we could have a new option "--cc-list=$filename" to support that use case. I however doubt anything that starts with "First you make a list of addresses in a flat file, and then do this" is a good solution.

I would think that it would probably be the best way to address "I often want to cc these recipients, but not always" is to keep a list of aliases, each entry of which expands to the recipients, and say "--cc=group" from the command line to have it expanded to the set of recipients.

Philip Oakley· Jul 21, 2015, 22:48 UTC · re: Junio C Hamano · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

From: "Junio C Hamano" <gitster@pobox.com>
Show 6 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> I was trying to use, essentially, 'cat list.txt' as the command,...
>
> One thing that needs to be made clear is that I do not think we want
> to encourage `cat list.txt #` abuse in the first place.
OK [1]
Show 7 quoted lines
>   It is an
> unacceptable hack for us to encourage in the longer term.  It may
> happen to work with the current implementation, but it does so
> merely by depending on the implementation too much.
>
> If it is so common to want to spray all your patches to exactly the
> same list of recipients that is unconditionally determined, having

It wasn't 'unconditional spraying' ;-), rather I'd carefully select who to send to for each series, previously with multiple cc=".." on the command line.

Show 9 quoted lines
> multiple sendemail.cc configuration variables, which are cumulative,
> is already one way to do so, and you do not have to type such a long
> option "--cc-cmd='cat $filename'" every time.
>
> And if you do not want configuration for some reason, and having a
> list of addresses in a flat file is so common, we could have a new
> option "--cc-list=$filename" to support that use case.  I however
> doubt anything that starts with "First you make a list of addresses
> in a flat file, and then do this" is a good solution.

For a longer series, a list will still need collating by the OP somehow, but I don't think that alone would justify a new option.

Show 7 quoted lines
>
> I would think that it would probably be the best way to address "I
> often want to cc these recipients, but not always" is to keep a list
> of aliases, each entry of which expands to the recipients, and say
> "--cc=group" from the command line to have it expanded to the set of
> recipients.
>

[1] You mentioned in the previous email the script command argv[] array, which I hadn't heard of (for a script), having been used the $1, $2, method.

Given that new understanding, IIUC the proposal is that the garantee is the "--cc-cmd" should be a single command/script name, with the patchfilename passed as $1, and that a 'string string' for interpretation would now be deprecated.

I'll see about a shorter doc patch that restricts itself to just the base aspects, if that would be acceptable? -- Philip

Junio C Hamano· Jul 22, 2015, 18:58 UTC · re: Philip Oakley · lore

Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation

"Philip Oakley" <philipoakley@iee.org> writes:
Show 10 quoted lines
>>   It is an
>> unacceptable hack for us to encourage in the longer term.  It may
>> happen to work with the current implementation, but it does so
>> merely by depending on the implementation too much.
>>
>> If it is so common to want to spray all your patches to exactly the
>> same list of recipients that is unconditionally determined, having
>
> It wasn't 'unconditional spraying' ;-), rather I'd carefully select
> who to send to for each series, ...

I meant unconditional in the sense that all messages in the series will get exactly the same cc: list (instead of the cc-cmd inspecting each message and deciding whom to include conditionally).

Show 5 quoted lines
>> I would think that it would probably be the best way to address "I
>> often want to cc these recipients, but not always" is to keep a list
>> of aliases, each entry of which expands to the recipients, and say
>> "--cc=group" from the command line to have it expanded to the set of
>> recipients.

I think one of the topics that was reviewed and queued during this cycle will help the above (it may not be in 'master' yet hence not in 2.5, but there always is the next release), where it made sure that alias expansion happens more consistently than before.

← back to recent threads