From 957ed3a56c50f5c542e0cac58d75e1d4b9658ac3 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Tue, 23 Aug 2016 15:45:50 -0700 Subject: format-patch: show 0/1 and 1/1 for singleton patch with cover letter Change the default behavior of git-format-patch to generate numbered sequence of 0/1 and 1/1 when generating both a cover-letter and a single patch. This standardizes the cover letter to have 0/N which helps distinguish the cover letter from the patch itself. Since the behavior is easily changed via configuration as well as the use of -n and -N this should be acceptable default behavior. Add tests for the new default behavior. Signed-off-by: Jacob Keller Signed-off-by: Junio C Hamano --- builtin/log.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/log.c b/builtin/log.c index 099f4f7be9..b7bfeb9586 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) - 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 */ -- cgit v1.2.3