Skip to contentSkip to conversation

"git am" gets confused when commit message contains text looking like a diff

BUG Thorsten Otto 2 participants 2 messages Aug 20, 2022

lore
Share & tools
lore
#0 lore raw

Observed on the releases/gcc-6 branch of https://github.com/gcc-mirror/gcc . There is a commit backported from the main branch, which looks like the attached file when extracting it with "git format-patch -1 c86135dec7521ca3a877fa455b449dd8aa068a9c".

When trying to apply that patch with "git am", you get an error message:

error: config/rs6000/rs6000.md (working copy): does not exist in index

Apparently git tries to apply the diff from the git commit message, instead of the real diff.

From c86135dec7521ca3a877fa455b449dd8aa068a9c Mon Sep 17 00:00:00 2001
From: Aaron Sawdey <[email protected]>
Date: Tue, 14 Mar 2017 14:43:03 +0000
Subject: [PATCH] This showed up in power9 code for __divkf3 software float
support and caused a...

This showed up in power9 code for __divkf3 software float support and caused a divd to be emitted where we needed a divdu.

config/rs6000/rs6000.md (working copy) renamed from config/rs6000/rs6000.md (revision 246123) +2 -2
Index: gcc/config/rs6000/rs6000.md
===================================================================
@@ -3063,8 +3063,8 @@
    && ! reg_mentioned_p (operands[3], operands[1])
    && ! reg_mentioned_p (operands[3], operands[2])"
   [(set (match_dup 0)
-       (div:GPR (match_dup 1)
-                (match_dup 2)))
+       (udiv:GPR (match_dup 1)
+                 (match_dup 2)))
    (set (match_dup 3)
        (mult:GPR (match_dup 0)
                  (match_dup 2)))

2017-03-14 Aaron Sawdey <[email protected]>

Backport from mainline
2017-02-28 Aaron Sawdey <[email protected]>

PR target/79752
* config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit udiv rather than div since input pattern is unsigned.

From-SVN: r246127

---
 gcc/ChangeLog               | 9 +++++++++
 gcc/config/rs6000/rs6000.md | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
gcc/ChangeLog +9 -0
index a65effcebc2..9a9858ce86e 100644
@@ -1,3 +1,12 @@
+2017-03-14  Aaron Sawdey  <[email protected]>
+
+	Backport from mainline
+	2017-02-28  Aaron Sawdey  <[email protected]>
+
+	PR target/79752
+        * config/rs6000/rs6000.md (peephole2 for udiv/umod): Should emit
+        udiv rather than div since input pattern is unsigned.
+
 2017-03-14  Richard Biener  <[email protected]>
 
 	Backport from mainline
gcc/config/rs6000/rs6000.md +2 -2
index b2592b55a25..c54e7271302 100644
@@ -3063,8 +3063,8 @@
    && ! reg_mentioned_p (operands[3], operands[1])
    && ! reg_mentioned_p (operands[3], operands[2])"
   [(set (match_dup 0)
-	(div:GPR (match_dup 1)
-		 (match_dup 2)))
+	(udiv:GPR (match_dup 1)
+		  (match_dup 2)))
    (set (match_dup 3)
 	(mult:GPR (match_dup 0)
 		  (match_dup 2)))
Signature · 1 line
2.24.0
#1 lore raw
Quoted 2 lines · Thorsten Otto

Apparently git tries to apply the diff from the git commit message, instead of the real diff.

This is very much expected, and that is why people indent diffs they quote to support their commit log messages.