{"thread":{"id":"32106","subject":"bug? git format-patch -M -D then git am fails","startedAt":"2012-11-13T22:45:21Z","lastAt":"2012-11-14T13:28:00Z","messageCount":5,"participants":["Joe Perches","Junio C Hamano","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"203153","messageId":"1352846721.17444.24.camel@joe-AO722","threadId":"32106","inReplyTo":null,"subject":"bug? git format-patch -M -D then git am fails","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2012-11-13T22:45:21Z","receivedAt":"2012-11-13T22:45:21Z","isPatch":false,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"(Sorry about the partial message.\n evolution and ctrl-enter sends, grumble...)\n\nIf a file is deleted with git rm and a patch\nis then generated with git format-patch -M -D\ngit am is unable to apply the resultant patch.\n\nIs this working as designed?\n"},{"id":"203154","messageId":"7vsj8dcdv6.fsf@alter.siamese.dyndns.org","threadId":"32106","inReplyTo":"1352846721.17444.24.camel@joe-AO722","subject":"Re: bug? git format-patch -M -D then git am fails","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-13T22:55:09Z","receivedAt":"2012-11-13T22:55:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joe Perches <joe@perches.com> writes:\n\n> (Sorry about the partial message.\n>  evolution and ctrl-enter sends, grumble...)\n>\n> If a file is deleted with git rm and a patch\n> is then generated with git format-patch -M -D\n> git am is unable to apply the resultant patch.\n>\n> Is this working as designed?\n\nI would say it is broken as designed and it is even documented.\n\nPlease run \"git format-patch --help | less\" and then type\n\"/--irreversible-delete\" to find:\n\n    The resulting patch is not meant to be applied with patch nor\n    git apply; this is solely for people who want to just\n    concentrate on reviewing the text after the change.\n"},{"id":"203156","messageId":"1352847962.17444.27.camel@joe-AO722","threadId":"32106","inReplyTo":"7vsj8dcdv6.fsf@alter.siamese.dyndns.org","subject":"Re: bug? git format-patch -M -D then git am fails","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2012-11-13T23:06:02Z","receivedAt":"2012-11-13T23:06:02Z","isPatch":false,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"On Tue, 2012-11-13 at 14:55 -0800, Junio C Hamano wrote:\n> Joe Perches <joe@perches.com> writes:\n> \n> > (Sorry about the partial message.\n> >  evolution and ctrl-enter sends, grumble...)\n> >\n> > If a file is deleted with git rm and a patch\n> > is then generated with git format-patch -M -D\n> > git am is unable to apply the resultant patch.\n> >\n> > Is this working as designed?\n> \n> I would say it is broken as designed and it is even documented.\n> \n> Please run \"git format-patch --help | less\" and then type\n> \"/--irreversible-delete\" to find:\n> \n>     The resulting patch is not meant to be applied with patch nor\n>     git apply; this is solely for people who want to just\n>     concentrate on reviewing the text after the change.\n\nyeah, it's just that not using -D can result in\nsome unfortunately large patches being sent to\nmailing lists.  I don't believe that reversibility\nis a really useful aspect of deletion patches\nwhen there are known git repositories involved.\n\ncheers, Joe\n"},{"id":"203158","messageId":"7vfw4dccm7.fsf@alter.siamese.dyndns.org","threadId":"32106","inReplyTo":"1352847962.17444.27.camel@joe-AO722","subject":"Re: bug? git format-patch -M -D then git am fails","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-13T23:22:08Z","receivedAt":"2012-11-13T23:22:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joe Perches <joe@perches.com> writes:\n\n> I don't believe that reversibility\n> is a really useful aspect of deletion patches\n> when there are known git repositories involved.\n\nYou can read \"reversibility\" as \"safety\" if you want.  We would want\nto make sure we know what we are deleting before deleting a path.\n\nThe history that the receiver of such a patch has may have further\nchanges that are relevant that the sender of the deletion patch did\nnot know about, and removing the path in such a case would make the\nresult inconsistent.  If the sender did his work on top of the newer\nversion with the change in the path, the sender's patch may still\nhave deleted the path but would have had changes to other paths to\ncompensate for the loss of that change.\n"},{"id":"203187","messageId":"50A39C60.7000005@drmicha.warpmail.net","threadId":"32106","inReplyTo":"7vfw4dccm7.fsf@alter.siamese.dyndns.org","subject":"Re: bug? git format-patch -M -D then git am fails","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2012-11-14T13:28:00Z","receivedAt":"2012-11-14T13:28:00Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 14.11.2012 00:22:\n> Joe Perches <joe@perches.com> writes:\n> \n>> I don't believe that reversibility\n>> is a really useful aspect of deletion patches\n>> when there are known git repositories involved.\n> \n> You can read \"reversibility\" as \"safety\" if you want.  We would want\n> to make sure we know what we are deleting before deleting a path.\n> \n> The history that the receiver of such a patch has may have further\n> changes that are relevant that the sender of the deletion patch did\n> not know about, and removing the path in such a case would make the\n> result inconsistent.  If the sender did his work on top of the newer\n> version with the change in the path, the sender's patch may still\n> have deleted the path but would have had changes to other paths to\n> compensate for the loss of that change.\n> \n\nJust in case someone wants to hack on this: To be safe, \"git am\" would\nneed to read the blob's sha1 from something like\n\ndiff --git a/Makefile b/Makefile\ndeleted file mode 100644\nindex 1b6d84d..0000000\n\nand check that the file to be deleted matches.\n\nMichael\n"}]}