{"thread":{"id":"25373","subject":"format-patch on permission change gives empty patch","startedAt":"2010-10-07T00:37:14Z","lastAt":"2010-10-07T20:29:29Z","messageCount":9,"participants":["David Miller","Junio C Hamano","Sverre Rabbelier","Jakub Narebski","Nicolas Pitre"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"152832","messageId":"20101006.173714.245380201.davem@davemloft.net","threadId":"25373","inReplyTo":null,"subject":"format-patch on permission change gives empty patch","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2010-10-07T00:37:14Z","receivedAt":"2010-10-07T00:37:14Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"\nWhen I ask git to format-patch a commit that is just a file\npermission change, it ends up generating an empty file, not\neven the commit message is included.\n\ndavem@sunset:~/src/GIT/net-2.6$ git show\ncommit a5dbc62ed61bf4cc57e22b78e5794880f1c74b90\nAuthor: Joe Perches <joe@perches.com>\nDate:   Wed Oct 6 17:32:49 2010 -0700\n\n    Documentation/networking/ixgbevf.txt: Change file permissions to 644\n    \n    Signed-off-by: Joe Perches <joe@perches.com>\n    Signed-off-by: David S. Miller <davem@davemloft.net>\nYou have new mail in /var/mail/davem\ndavem@sunset:~/src/GIT/net-2.6$ git format-patch HEAD^\n0001-Documentation-networking-ixgbevf.txt-Change-file-per.patch\ndavem@sunset:~/src/GIT/net-2.6$ ls -l 0001-Documentation-networking-ixgbevf.txt-Change-file-per.patch \n-rw-r--r-- 1 davem davem 0 Oct  6 17:36 0001-Documentation-networking-ixgbevf.txt-Change-file-per.patch\ndavem@sunset:~/src/GIT/net-2.6$ git version\ngit version 1.7.3.1\n"},{"id":"152834","messageId":"20101006.174008.70175671.davem@davemloft.net","threadId":"25373","inReplyTo":"20101006.173714.245380201.davem@davemloft.net","subject":"Re: format-patch on permission change gives empty patch","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2010-10-07T00:40:08Z","receivedAt":"2010-10-07T00:40:08Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"From: David Miller <davem@davemloft.net>\nDate: Wed, 06 Oct 2010 17:37:14 -0700 (PDT)\n\n> \n> When I ask git to format-patch a commit that is just a file\n> permission change, it ends up generating an empty file, not\n> even the commit message is included.\n\nOk it turns out that the commit in question was a NOP since the file\npermissions didn't change.\n\nBut even if the patch is truly empty, format-patch should still give\nme the commit message shouldn't it?\n"},{"id":"152838","messageId":"7vtykyy70w.fsf@alter.siamese.dyndns.org","threadId":"25373","inReplyTo":"20101006.174008.70175671.davem@davemloft.net","subject":"Re: format-patch on permission change gives empty patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-07T04:13:35Z","receivedAt":"2010-10-07T04:13:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Miller <davem@davemloft.net> writes:\n\n> From: David Miller <davem@davemloft.net>\n> Date: Wed, 06 Oct 2010 17:37:14 -0700 (PDT)\n>\n>> \n>> When I ask git to format-patch a commit that is just a file\n>> permission change, it ends up generating an empty file, not\n>> even the commit message is included.\n>\n> Ok it turns out that the commit in question was a NOP since the file\n> permissions didn't change.\n>\n> But even if the patch is truly empty, format-patch should still give\n> me the commit message shouldn't it?\n\nProbably; we have strongly encouraged people not to commit no-op, so I\nguess nobody stumbled upon this corner case.\n\nPerhaps something like this?\n\n builtin/log.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 22d1290..6baba7d 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1057,6 +1057,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \trev.verbose_header = 1;\n \trev.diff = 1;\n \trev.no_merges = 1;\n+\trev.always_show_header = 1;\n \tDIFF_OPT_SET(&rev.diffopt, RECURSIVE);\n \trev.subject_prefix = fmt_patch_subject_prefix;\n \tmemset(&s_r_opt, 0, sizeof(s_r_opt));\n"},{"id":"152840","messageId":"7vocb6y5sq.fsf@alter.siamese.dyndns.org","threadId":"25373","inReplyTo":"7vtykyy70w.fsf@alter.siamese.dyndns.org","subject":"Re: format-patch on permission change gives empty patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-07T04:40:05Z","receivedAt":"2010-10-07T04:40:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> David Miller <davem@davemloft.net> writes:\n>\n>> From: David Miller <davem@davemloft.net>\n>> Date: Wed, 06 Oct 2010 17:37:14 -0700 (PDT)\n>>\n>>> \n>>> When I ask git to format-patch a commit that is just a file\n>>> permission change, it ends up generating an empty file, not\n>>> even the commit message is included.\n>>\n>> Ok it turns out that the commit in question was a NOP since the file\n>> permissions didn't change.\n>>\n>> But even if the patch is truly empty, format-patch should still give\n>> me the commit message shouldn't it?\n>\n> Probably; we have strongly encouraged people not to commit no-op, so I\n> guess nobody stumbled upon this corner case.\n>\n> Perhaps something like this?\n\nActually, I have a feeling that this is not merely a corner case we didn't\ncare about.\n\nA half-good news is that format-patch already takes --always command line\noption to generate a message out of an empty commit, but because it cannot\nbe applied with \"am\", it is rather pointless.\n\nBUT.\n\nThe weatherbaloon patch is probably a bad idea.  \"git rebase\", especially\nwhen rebasing a side branch imported from some foreign SCM, would rather\nbadly break with this patch, because its \"format-patch | am\" pipeline\ndepends on format-patch to skip a no-op commit.  Otherwise, \"am\" will\ncomplain about a patchless message.  So in a sense, the current behaviour\nis internally consistent and deliberately so.\n\nI have a mixed feeling about where to go next.\n\n (1) Treat \"rebase\" as a way to reproduce a reasonable history; the\n     current behaviour to drop empty commits is consistent with this view,\n     as a history with an empty commit is _not_ entirely reasonable.\n\n (2) Treat \"rebase\" as a way to reproduce history faithfully, even an\n     unreasonable one.  We could teach \"--allow-empty\" to \"am\", and\n     rewrite the pipeline as \"format-patch --always | am --allow-empty\" to\n     implement it.\n\nI think I would eventually end up doing the latter, but not tonight.\n"},{"id":"152858","messageId":"AANLkTimA4jrDXmfJp2em34fj6b1sj9kdEyZ_xPTzqcEN@mail.gmail.com","threadId":"25373","inReplyTo":"7vocb6y5sq.fsf@alter.siamese.dyndns.org","subject":"Re: format-patch on permission change gives empty patch","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-10-07T08:15:49Z","receivedAt":"2010-10-07T08:15:49Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Oct 7, 2010 at 06:40, Junio C Hamano <gitster@pobox.com> wrote:\n>  (2) Treat \"rebase\" as a way to reproduce history faithfully, even an\n>     unreasonable one.  We could teach \"--allow-empty\" to \"am\", and\n>     rewrite the pipeline as \"format-patch --always | am --allow-empty\" to\n>     implement it.\n\nWouldn't we then have to keep adding options for other corner cases?\nPerhaps a '--plumbing' flag that makes format-patch behave sanely\n(e.g., also do stuff like, turn off color and whatnot) and that makes\n'git am' accept everything it knows how to understand?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"152866","messageId":"m3eic2fher.fsf@localhost.localdomain","threadId":"25373","inReplyTo":"AANLkTimA4jrDXmfJp2em34fj6b1sj9kdEyZ_xPTzqcEN@mail.gmail.com","subject":"Re: format-patch on permission change gives empty patch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-10-07T10:05:07Z","receivedAt":"2010-10-07T10:05:07Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n> On Thu, Oct 7, 2010 at 06:40, Junio C Hamano <gitster@pobox.com> wrote:\n\n> >  (2) Treat \"rebase\" as a way to reproduce history faithfully, even an\n> >     unreasonable one.  We could teach \"--allow-empty\" to \"am\", and\n> >     rewrite the pipeline as \"format-patch --always | am --allow-empty\" to\n> >     implement it.\n> \n> Wouldn't we then have to keep adding options for other corner cases?\n> Perhaps a '--plumbing' flag that makes format-patch behave sanely\n> (e.g., also do stuff like, turn off color and whatnot) and that makes\n> 'git am' accept everything it knows how to understand?\n\nHmmm... doesn't rebase pipeline use \"format-patch --rebasing\" (where\n'--rebasing' is internal option deliberately left undocumented)?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"152867","messageId":"AANLkTik=3bT3h3tCsm3nAdi=VbwJsY0+33HPpF0_m36X@mail.gmail.com","threadId":"25373","inReplyTo":"m3eic2fher.fsf@localhost.localdomain","subject":"Re: format-patch on permission change gives empty patch","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-10-07T10:12:38Z","receivedAt":"2010-10-07T10:12:38Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Oct 7, 2010 at 12:05, Jakub Narebski <jnareb@gmail.com> wrote:\n> Hmmm... doesn't rebase pipeline use \"format-patch --rebasing\" (where\n> '--rebasing' is internal option deliberately left undocumented)?\n\nIf so, that's exactly what I mean :)\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"152907","messageId":"alpine.LFD.2.00.1010071503210.3107@xanadu.home","threadId":"25373","inReplyTo":"7vocb6y5sq.fsf@alter.siamese.dyndns.org","subject":"Re: format-patch on permission change gives empty patch","fromName":"Nicolas Pitre","fromEmail":"nico@fluxnic.net","sentAt":"2010-10-07T19:06:05Z","receivedAt":"2010-10-07T19:06:05Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 6 Oct 2010, Junio C Hamano wrote:\n\n> I have a mixed feeling about where to go next.\n> \n>  (1) Treat \"rebase\" as a way to reproduce a reasonable history; the\n>      current behaviour to drop empty commits is consistent with this view,\n>      as a history with an empty commit is _not_ entirely reasonable.\n\nBut a file mode change isn't exactly an empty commit, no?\n\n\nNicolas\n"},{"id":"152927","messageId":"7vmxqpwxue.fsf@alter.siamese.dyndns.org","threadId":"25373","inReplyTo":"alpine.LFD.2.00.1010071503210.3107@xanadu.home","subject":"Re: format-patch on permission change gives empty patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-07T20:29:29Z","receivedAt":"2010-10-07T20:29:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicolas Pitre <nico@fluxnic.net> writes:\n\n> On Wed, 6 Oct 2010, Junio C Hamano wrote:\n>\n>> I have a mixed feeling about where to go next.\n>> \n>>  (1) Treat \"rebase\" as a way to reproduce a reasonable history; the\n>>      current behaviour to drop empty commits is consistent with this view,\n>>      as a history with an empty commit is _not_ entirely reasonable.\n>\n> But a file mode change isn't exactly an empty commit, no?\n\nThe second message from DaveM:\n\n    Message-ID: <20101006.174008.70175671.davem@davemloft.net>\n\n    Ok it turns out that the commit in question was a NOP since the file\n    permissions didn't change.\n"}]}