From: Stephen Boyd <bebarino@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Björn Gustavsson" <bgustavsson@gmail.com>
Subject: [PATCH bg/format-patch-p-noop] log-tree: always add --- marker when options are patch and a stat
Date: Tue, 3 Nov 2009 13:24:16 -0800 [thread overview]
Message-ID: <1257283456-7007-1-git-send-email-bebarino@gmail.com> (raw)
Previously, the three dash marker (---) would only be added if the diff
output format was a patch and diffstat (usually -p and --stat). Now that
patches are always generated by format-patch regardless of the stat
format being used (--stat, --raw, --numstat, etc.), always add the three
dash marker when a patch is being generated and a stat option is used.
This allows users to choose the stat format they want and unifies the
format of patches with stats. It also make patches easier to apply when
generated by format-patch with non-standard stat options as the stat is
no longer considered part of the commit message.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
It seems that after looking at this series it would be better if the
marker is always displayed even when a user has used a non-standard
stat option with format-patch.
I'm not sure this is wanted though and I guess this could break people's
scripts. Are people actually using --numstat or --raw to put the stat into
the commit message?
log-tree.c | 5 +++--
...f-tree_--pretty_--root_--patch-with-raw_initial | 2 +-
t/t4013/diff.show_--patch-with-raw_side | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/log-tree.c b/log-tree.c
index 1618f3c..1871c6c 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -461,8 +461,9 @@ int log_tree_diff_flush(struct rev_info *opt)
if ((opt->diffopt.output_format & ~DIFF_FORMAT_NO_OUTPUT) &&
opt->verbose_header &&
opt->commit_format != CMIT_FMT_ONELINE) {
- int pch = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
- if ((pch & opt->diffopt.output_format) == pch)
+ int pch = DIFF_FORMAT_PATCH;
+ int fmt = opt->diffopt.output_format;
+ if (pch & fmt && pch ^ fmt)
printf("---");
putchar('\n');
}
diff --git a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial
index a3203bd..2f4fec9 100644
--- a/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial
+++ b/t/t4013/diff.diff-tree_--pretty_--root_--patch-with-raw_initial
@@ -4,7 +4,7 @@ Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000
Initial
-
+---
:000000 100644 0000000000000000000000000000000000000000 35d242ba79ae89ac695e26b3d4c27a8e6f028f9e A dir/sub
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file0
:000000 100644 0000000000000000000000000000000000000000 01e79c32a8c99c557f0757da7cb6d65b3414466d A file2
diff --git a/t/t4013/diff.show_--patch-with-raw_side b/t/t4013/diff.show_--patch-with-raw_side
index 221b46a..b7566be 100644
--- a/t/t4013/diff.show_--patch-with-raw_side
+++ b/t/t4013/diff.show_--patch-with-raw_side
@@ -4,7 +4,7 @@ Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
Side
-
+---
:100644 100644 35d242b... 7289e35... M dir/sub
:100644 100644 01e79c3... f4615da... M file0
:000000 100644 0000000... 7289e35... A file3
--
1.6.5.2.181.gd6f41
next reply other threads:[~2009-11-03 21:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-03 21:24 Stephen Boyd [this message]
2009-11-04 5:49 ` [PATCH bg/format-patch-p-noop] log-tree: always add --- marker when options are patch and a stat Junio C Hamano
2009-11-04 6:36 ` Jeff King
2009-11-04 7:10 ` Jeff King
2009-11-04 7:19 ` Jeff King
2009-11-04 7:35 ` Stephen Boyd
2009-11-04 7:37 ` Jeff King
2009-11-04 18:10 ` Junio C Hamano
2009-11-04 7:49 ` Björn Gustavsson
2009-11-04 7:26 ` Junio C Hamano
2009-11-04 7:00 ` Björn Gustavsson
2009-11-04 7:31 ` Junio C Hamano
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=1257283456-7007-1-git-send-email-bebarino@gmail.com \
--to=bebarino@gmail.com \
--cc=bgustavsson@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).