Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: format-patch on permission change gives empty patch

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:43
Subsystem: the rest · Maintainer: Linus Torvalds

David Miller [off-list ref] writes:
From: David Miller <davem@davemloft.net>
Date: Wed, 06 Oct 2010 17:37:14 -0700 (PDT)
quoted
When I ask git to format-patch a commit that is just a file
permission change, it ends up generating an empty file, not
even the commit message is included.
Ok it turns out that the commit in question was a NOP since the file
permissions didn't change.

But even if the patch is truly empty, format-patch should still give
me the commit message shouldn't it?
Probably; we have strongly encouraged people not to commit no-op, so I
guess nobody stumbled upon this corner case.

Perhaps something like this?

 builtin/log.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 22d1290..6baba7d 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1057,6 +1057,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 	rev.verbose_header = 1;
 	rev.diff = 1;
 	rev.no_merges = 1;
+	rev.always_show_header = 1;
 	DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
 	rev.subject_prefix = fmt_patch_subject_prefix;
 	memset(&s_r_opt, 0, sizeof(s_r_opt));
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help