{"thread":{"id":"58335","subject":"[BUG] \"git am\" gets confused when commit message contains text looking like a diff","startedAt":"2022-08-20T07:21:49Z","lastAt":"2022-08-20T21:35:54Z","messageCount":2,"participants":["Thorsten Otto","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"461648","messageId":"16297305.cDA1TJNmNo@earendil","threadId":"58335","inReplyTo":null,"subject":"[BUG] \"git am\" gets confused when commit message contains text looking like a diff","fromName":"Thorsten Otto","fromEmail":"admin@tho-otto.de","sentAt":"2022-08-20T07:12:04Z","receivedAt":"2022-08-20T07:21:49Z","isPatch":false,"sender":{"key":"admin@tho-otto.de","avatar":null},"body":"Observed on the releases/gcc-6 branch of https://github.com/gcc-mirror/gcc . \nThere is a commit backported from the main branch, which looks like the \nattached file when extracting it with \"git format-patch -1 \nc86135dec7521ca3a877fa455b449dd8aa068a9c\".\n\nWhen trying to apply that patch with \"git am\", you get an error message:\n\nerror: config/rs6000/rs6000.md (working copy): does not exist in index\n\nApparently git tries to apply the diff from the git commit message, instead of \nthe real diff.\n\n\nFrom c86135dec7521ca3a877fa455b449dd8aa068a9c Mon Sep 17 00:00:00 2001\nFrom: Aaron Sawdey <acsawdey@linux.vnet.ibm.com>\nDate: Tue, 14 Mar 2017 14:43:03 +0000\nSubject: [PATCH] This showed up in power9 code for __divkf3 software float\n support and caused a...\n\nThis showed up in power9 code for __divkf3 software float support and\ncaused a divd to be emitted where we needed a divdu.\n\nIndex: gcc/config/rs6000/rs6000.md\n===================================================================\n--- gcc/config/rs6000/rs6000.md (revision 246123)\n+++ gcc/config/rs6000/rs6000.md (working copy)\n@@ -3063,8 +3063,8 @@\n    && ! reg_mentioned_p (operands[3], operands[1])\n    && ! reg_mentioned_p (operands[3], operands[2])\"\n   [(set (match_dup 0)\n-       (div:GPR (match_dup 1)\n-                (match_dup 2)))\n+       (udiv:GPR (match_dup 1)\n+                 (match_dup 2)))\n    (set (match_dup 3)\n        (mult:GPR (match_dup 0)\n                  (match_dup 2)))\n\n2017-03-14  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>\n\n\tBackport from mainline\n\t2017-02-28  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>\n\n\tPR target/79752\n        * config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit\n        udiv rather than div since input pattern is unsigned.\n\nFrom-SVN: r246127\n---\n gcc/ChangeLog               | 9 +++++++++\n gcc/config/rs6000/rs6000.md | 4 ++--\n 2 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/gcc/ChangeLog b/gcc/ChangeLog\nindex a65effcebc2..9a9858ce86e 100644\n--- a/gcc/ChangeLog\n+++ b/gcc/ChangeLog\n@@ -1,3 +1,12 @@\n+2017-03-14  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>\n+\n+\tBackport from mainline\n+\t2017-02-28  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>\n+\n+\tPR target/79752\n+        * config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit\n+        udiv rather than div since input pattern is unsigned.\n+\n 2017-03-14  Richard Biener  <rguenther@suse.de>\n \n \tBackport from mainline\ndiff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md\nindex b2592b55a25..c54e7271302 100644\n--- a/gcc/config/rs6000/rs6000.md\n+++ b/gcc/config/rs6000/rs6000.md\n@@ -3063,8 +3063,8 @@\n    && ! reg_mentioned_p (operands[3], operands[1])\n    && ! reg_mentioned_p (operands[3], operands[2])\"\n   [(set (match_dup 0)\n-\t(div:GPR (match_dup 1)\n-\t\t (match_dup 2)))\n+\t(udiv:GPR (match_dup 1)\n+\t\t  (match_dup 2)))\n    (set (match_dup 3)\n \t(mult:GPR (match_dup 0)\n \t\t  (match_dup 2)))\n-- \n2.24.0\n\n"},{"id":"461665","messageId":"xmqqleriha2z.fsf@gitster.g","threadId":"58335","inReplyTo":"16297305.cDA1TJNmNo@earendil","subject":"Re: [BUG] \"git am\" gets confused when commit message contains text looking like a diff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-20T21:35:48Z","receivedAt":"2022-08-20T21:35:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thorsten Otto <admin@tho-otto.de> writes:\n\n> Apparently git tries to apply the diff from the git commit message, instead of \n> the real diff.\n\nThis is very much expected, and that is why people indent diffs they\nquote to support their commit log messages.\n\n"}]}