git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/3] Update send-email cc-cmd documentation
@ 2015-07-20 18:26 Philip Oakley
  2015-07-20 18:26 ` [PATCH 1/3] doc: convert send-email option headings to nouns Philip Oakley
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:26 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Eric Sunshine

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

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

* [PATCH 1/3] doc: convert send-email option headings to nouns
  2015-07-20 18:26 [PATCH 0/3] Update send-email cc-cmd documentation Philip Oakley
@ 2015-07-20 18:26 ` Philip Oakley
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc' Philip Oakley
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:26 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Eric Sunshine

... 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(-)

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

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

* [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc'
  2015-07-20 18:26 [PATCH 0/3] Update send-email cc-cmd documentation Philip Oakley
  2015-07-20 18:26 ` [PATCH 1/3] doc: convert send-email option headings to nouns Philip Oakley
@ 2015-07-20 18:26 ` Philip Oakley
  2015-07-20 18:34   ` Eric Sunshine
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand oon " Philip Oakley
  2015-07-20 18:26 ` [PATCH 3/3] doc: give examples for send-email cc-cmd operation Philip Oakley
  3 siblings, 1 reply; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:26 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Eric Sunshine

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 Documentation/git-send-email.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [PATCH 2/3] doc: send-email; expand oon the meaning of 'auto-cc'
  2015-07-20 18:26 [PATCH 0/3] Update send-email cc-cmd documentation Philip Oakley
  2015-07-20 18:26 ` [PATCH 1/3] doc: convert send-email option headings to nouns Philip Oakley
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc' Philip Oakley
@ 2015-07-20 18:26 ` Philip Oakley
  2015-07-20 18:55   ` Philip Oakley
  2015-07-20 18:26 ` [PATCH 3/3] doc: give examples for send-email cc-cmd operation Philip Oakley
  3 siblings, 1 reply; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:26 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Eric Sunshine

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 Documentation/git-send-email.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

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

* [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 18:26 [PATCH 0/3] Update send-email cc-cmd documentation Philip Oakley
                   ` (2 preceding siblings ...)
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand oon " Philip Oakley
@ 2015-07-20 18:26 ` Philip Oakley
  2015-07-20 18:50   ` Eric Sunshine
  2015-07-20 19:59   ` Junio C Hamano
  3 siblings, 2 replies; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:26 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano, Eric Sunshine

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(+)

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

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

* Re: [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc'
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc' Philip Oakley
@ 2015-07-20 18:34   ` Eric Sunshine
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Sunshine @ 2015-07-20 18:34 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Junio C Hamano

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/;/:/

> 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

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 18:26 ` [PATCH 3/3] doc: give examples for send-email cc-cmd operation Philip Oakley
@ 2015-07-20 18:50   ` Eric Sunshine
  2015-07-20 19:14     ` Eric Sunshine
  2015-07-20 19:36     ` Philip Oakley
  2015-07-20 19:59   ` Junio C Hamano
  1 sibling, 2 replies; 18+ messages in thread
From: Eric Sunshine @ 2015-07-20 18:50 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Junio C Hamano

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.)

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.

>  SEE ALSO
>  --------
>  linkgit:git-format-patch[1], linkgit:git-imap-send[1], mbox(5)
> --
> 2.4.2.windows.1.5.gd32afb6
>

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

* Re: [PATCH 2/3] doc: send-email; expand oon the meaning of 'auto-cc'
  2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand oon " Philip Oakley
@ 2015-07-20 18:55   ` Philip Oakley
  0 siblings, 0 replies; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 18:55 UTC (permalink / raw)
  To: Philip Oakley, Git List; +Cc: Junio C Hamano, Eric Sunshine

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 ----- 
> 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'

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 18:50   ` Eric Sunshine
@ 2015-07-20 19:14     ` Eric Sunshine
  2015-07-20 20:26       ` Eric Sunshine
  2015-07-20 19:36     ` Philip Oakley
  1 sibling, 1 reply; 18+ messages in thread
From: Eric Sunshine @ 2015-07-20 19:14 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Junio C Hamano

On Mon, Jul 20, 2015 at 2:50 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> 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'

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 18:50   ` Eric Sunshine
  2015-07-20 19:14     ` Eric Sunshine
@ 2015-07-20 19:36     ` Philip Oakley
  2015-07-20 20:36       ` Eric Sunshine
  1 sibling, 1 reply; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 19:36 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git List, Junio C Hamano

From: "Eric Sunshine" <sunshine@sunshineco.com>
> 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.

>
> 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."


>
>>  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
> 

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 18:26 ` [PATCH 3/3] doc: give examples for send-email cc-cmd operation Philip Oakley
  2015-07-20 18:50   ` Eric Sunshine
@ 2015-07-20 19:59   ` Junio C Hamano
  2015-07-20 21:35     ` Philip Oakley
  1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2015-07-20 19:59 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Eric Sunshine

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

    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?

> +	#!/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
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.

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 19:14     ` Eric Sunshine
@ 2015-07-20 20:26       ` Eric Sunshine
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Sunshine @ 2015-07-20 20:26 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Junio C Hamano

On Mon, Jul 20, 2015 at 3:14 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> 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).

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 19:36     ` Philip Oakley
@ 2015-07-20 20:36       ` Eric Sunshine
  0 siblings, 0 replies; 18+ messages in thread
From: Eric Sunshine @ 2015-07-20 20:36 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Junio C Hamano

On Mon, Jul 20, 2015 at 3:36 PM, Philip Oakley <philipoakley@iee.org> wrote:
> 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".

>> 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)

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 19:59   ` Junio C Hamano
@ 2015-07-20 21:35     ` Philip Oakley
  2015-07-20 22:37       ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Philip Oakley @ 2015-07-20 21:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List, Eric Sunshine

From: "Junio C Hamano" <gitster@pobox.com>
> 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)

>
>    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.

>
>> + #!/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.

> 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 

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 21:35     ` Philip Oakley
@ 2015-07-20 22:37       ` Junio C Hamano
  2015-07-20 22:59         ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2015-07-20 22:37 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Eric Sunshine

"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?

> 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?

>>    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.

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 22:37       ` Junio C Hamano
@ 2015-07-20 22:59         ` Junio C Hamano
  2015-07-21 22:48           ` Philip Oakley
  0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2015-07-20 22:59 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Eric Sunshine

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.

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-20 22:59         ` Junio C Hamano
@ 2015-07-21 22:48           ` Philip Oakley
  2015-07-22 18:58             ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Philip Oakley @ 2015-07-21 22:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List, Eric Sunshine

From: "Junio C Hamano" <gitster@pobox.com>
> 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]

>   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.

> 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.

>
> 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

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

* Re: [PATCH 3/3] doc: give examples for send-email cc-cmd operation
  2015-07-21 22:48           ` Philip Oakley
@ 2015-07-22 18:58             ` Junio C Hamano
  0 siblings, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2015-07-22 18:58 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Git List, Eric Sunshine

"Philip Oakley" <philipoakley@iee.org> writes:

>>   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).

>> 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.

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

end of thread, other threads:[~2015-07-22 18:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 18:26 [PATCH 0/3] Update send-email cc-cmd documentation Philip Oakley
2015-07-20 18:26 ` [PATCH 1/3] doc: convert send-email option headings to nouns Philip Oakley
2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand on the meaning of 'auto-cc' Philip Oakley
2015-07-20 18:34   ` Eric Sunshine
2015-07-20 18:26 ` [PATCH 2/3] doc: send-email; expand oon " Philip Oakley
2015-07-20 18:55   ` Philip Oakley
2015-07-20 18:26 ` [PATCH 3/3] doc: give examples for send-email cc-cmd operation Philip Oakley
2015-07-20 18:50   ` Eric Sunshine
2015-07-20 19:14     ` Eric Sunshine
2015-07-20 20:26       ` Eric Sunshine
2015-07-20 19:36     ` Philip Oakley
2015-07-20 20:36       ` Eric Sunshine
2015-07-20 19:59   ` Junio C Hamano
2015-07-20 21:35     ` Philip Oakley
2015-07-20 22:37       ` Junio C Hamano
2015-07-20 22:59         ` Junio C Hamano
2015-07-21 22:48           ` Philip Oakley
2015-07-22 18:58             ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).