git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Thomas Rast <trast@student.ethz.ch>,
	Stephen Boyd <bebarino@gmail.com>,
	Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: [PATCH v3 4/4] format-patch: add format.cover-letter configuration
Date: Sun, 07 Apr 2013 01:14:46 -0700	[thread overview]
Message-ID: <7v4nfi92q1.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1365318630-11882-5-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Sun, 7 Apr 2013 01:10:30 -0600")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> Also, add a new option: 'auto', so if there's more than one patch, the
> cover letter is generated, otherwise it's not.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  Documentation/config.txt           |  6 ++++++
>  Documentation/git-format-patch.txt |  5 +++--
>  builtin/log.c                      | 22 ++++++++++++++++------
>  3 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index c8e2178..c10195c 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1092,6 +1092,12 @@ format.signoff::
>      the rights to submit this work under the same open source license.
>      Please see the 'SubmittingPatches' document for further discussion.
>  
> +format.cover-letter::

I thought I saw somebody already pointed out that this was wrong.

> +	Allows to configure the --cover-letter option of format-patch by
> +	default.
> +	In addition, you can set it to 'auto' to automatically
> +	determine based on the number of patches (generate if there's more than
> +	one).

I find this somewhat a strange phrasing.  It _sets_ the default for
the cover-letter option, either to true or false or auto, so there
is no "in addition" about it.

Perhaps

format.coverLetter::
	Setting this variable to `true` (or `false`) tells the
	`format-patch` command to pretend the `--cover-letter` (or
	`--no-cover-letter`) was given from the command line.  When
	set to `auto`, `format-patch` assumes `--cover-letter` if
	and only if it is working on more than one commit.

or something?

It also is somewhat strange why the command line argument does not
accept `--cover-letter=auto` option.  In general, a configuration
variable should not be more flexible mechanism than what the command
line could give the user.  As I already said, I think that would be
a better longer-term default, and that makes it even more stand-out.

> @@ -1360,6 +1366,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  		numbered = 1;
>  	if (numbered)
>  		rev.total = total + start_number - 1;
> +	if (cover_letter == -1)
> +		cover_letter = (total > 1);
>  	if (in_reply_to || thread || cover_letter)
>  		rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));
>  	if (in_reply_to) {
> @@ -1371,6 +1379,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  	if (cover_letter) {
>  		if (thread)
>  			gen_message_id(&rev, "cover");
> +		if (!branch_name)
> +			branch_name = find_branch_name(&rev);
>  		make_cover_letter(&rev, use_stdout,
>  				  origin, nr, list, head, branch_name, quiet);
>  		total++;

This part is nicely done, thanks to the previous two steps.  You
might even want to remove the call to the find_branch_name() helper
function from here, and instead call it from make_cover_letter()
when branch_name is not yet there.

We would need tests to make sure future changes will not break this.

  reply	other threads:[~2013-04-07  8:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07  7:10 [PATCH v3 0/4] send-email: couple of improvements Felipe Contreras
2013-04-07  7:10 ` [PATCH v3 1/4] send-email: make annotate configurable Felipe Contreras
2013-04-07  7:42   ` Junio C Hamano
2013-04-07 16:45     ` Felipe Contreras
2013-04-07 17:22       ` Junio C Hamano
2013-04-07 17:58         ` Felipe Contreras
2013-04-07  7:10 ` [PATCH v3 2/4] format-patch: improve head calculation for cover-letter Felipe Contreras
2013-04-07  7:50   ` Junio C Hamano
2013-04-07  8:36     ` Felipe Contreras
2013-04-07  7:10 ` [PATCH v3 3/4] format-patch: refactor branch name calculation Felipe Contreras
2013-04-07  7:10 ` [PATCH v3 4/4] format-patch: add format.cover-letter configuration Felipe Contreras
2013-04-07  8:14   ` Junio C Hamano [this message]
2013-04-07  8:48     ` Felipe Contreras
2013-04-07  9:03       ` Junio C Hamano
2013-04-07  9:11         ` Felipe Contreras
2013-04-07 14:50           ` Matthieu Moy
2013-04-07 16:03             ` Felipe Contreras
2013-04-07 16:20               ` Matthieu Moy
2013-04-07 16:43                 ` Felipe Contreras
2013-04-07 17:22                 ` Junio C Hamano
2013-04-07 18:02                   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v4nfi92q1.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=barkalow@iabervon.org \
    --cc=bebarino@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).