git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Josh Triplett <josh@joshtriplett.org>,
	James Hogan <james.hogan@imgtec.com>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH] format-patch: show 0/1 and 1/1 for singleton patch with cover letter
Date: Tue, 23 Aug 2016 14:21:11 -0700	[thread overview]
Message-ID: <xmqqinuruqpk.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq37lvxx5o.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Tue, 23 Aug 2016 09:33:39 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> This obviously changes the behaviour, but I do not think of a reason
> why this change is a bad idea.  

>> diff --git a/builtin/log.c b/builtin/log.c
>> index 92dc34dcb0cc..8e6100fb0c5b 100644
>> --- a/builtin/log.c
>> +++ b/builtin/log.c
>> @@ -1676,7 +1676,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>>  		/* nothing to do */
>>  		return 0;
>>  	total = nr;
>> -	if (!keep_subject && auto_number && total > 1)
>> +	if (!keep_subject && auto_number && (total > 1 || cover_letter))
>>  		numbered = 1;
>>  	if (numbered)
>>  		rev.total = total + start_number - 1;

Actually there is a very good reason why this patch is not good
(yet).  When the --cover option is not specified on the command
line, cover_letter is -1 (use configuration or turn it on only when
it is a multi-patch series) at this point.

I think you would have noticed it if you ran any format-patch tests.
t/t4021-format-patch-numbered.sh fails at the very beginning.

With the attached SQUASH, existing tests pass, which is a strong
sign that this new feature needs to be protected by a new test in
the t4021 script to make sure other people would not break it in the
future.

 builtin/log.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index e50d361..b7bfeb9 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1650,16 +1650,16 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		/* nothing to do */
 		return 0;
 	total = nr;
-	if (!keep_subject && auto_number && (total > 1 || cover_letter))
-		numbered = 1;
-	if (numbered)
-		rev.total = total + start_number - 1;
 	if (cover_letter == -1) {
 		if (config_cover_letter == COVER_AUTO)
 			cover_letter = (total > 1);
 		else
 			cover_letter = (config_cover_letter == COVER_ON);
 	}
+	if (!keep_subject && auto_number && (total > 1 || cover_letter))
+		numbered = 1;
+	if (numbered)
+		rev.total = total + start_number - 1;
 
 	if (!signature) {
 		; /* --no-signature inhibits all signatures */

  parent reply	other threads:[~2016-08-23 21:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 23:49 [PATCH] format-patch: show 0/1 and 1/1 for singleton patch with cover letter Jacob Keller
2016-08-23 16:33 ` Junio C Hamano
2016-08-23 21:06   ` Jacob Keller
2016-08-23 21:21   ` Junio C Hamano [this message]
2016-08-23 21:28     ` Jacob Keller

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqinuruqpk.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=josh@joshtriplett.org \
    /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.
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).