git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: format-patch on permission change gives empty patch

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 7, 2010, 04:13 UTC
Message-ID
<7vtykyy70w.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101006.174008.70175671.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
Show 13 quoted lines
> From: David Miller <davem@davemloft.net>
> Date: Wed, 06 Oct 2010 17:37:14 -0700 (PDT)
>
>> 
>> 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));
Previous: David MillerNext: Junio C Hamano
Message 3 of 9 in “format-patch on permission change gives empty patch”
  1. David MillerOct 7, 2010
  2. David MillerOct 7, 2010
  3. Junio C HamanoOct 7, 2010
  4. Junio C HamanoOct 7, 2010
  5. Sverre RabbelierOct 7, 2010
  6. Jakub NarebskiOct 7, 2010
  7. Sverre RabbelierOct 7, 2010
  8. Nicolas PitreOct 7, 2010
  9. Junio C HamanoOct 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.