{"thread":{"id":"57793","subject":"Suggestion for the --word-diff","startedAt":"2022-04-25T19:36:08Z","lastAt":"2022-04-25T19:36:08Z","messageCount":1,"participants":["Jason Mathison"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"454405","messageId":"SJ0PR10MB564512089A259429773C2C7899F89@SJ0PR10MB5645.namprd10.prod.outlook.com","threadId":"57793","inReplyTo":"SJ0PR10MB5645CAAA092FE04C6A76B31E99F49@SJ0PR10MB5645.namprd10.prod.outlook.com","subject":"Suggestion for the --word-diff","fromName":"Jason Mathison","fromEmail":"jason.mathison@genesys.com","sentAt":"2022-04-25T19:34:15Z","receivedAt":"2022-04-25T19:36:08Z","isPatch":false,"sender":{"key":"jason.mathison@genesys.com","avatar":null},"body":"I ran into a situation where Git ends up giving a sort of strange diff in the --word-diff mode.\n\nStarting with something like this\n\nprotected static String deleteMe = \"I am going to be deleted\";\nprotected static Var1 var1;\nprotected static Var2 Var2;\nprotected static Var3 Var3;\n\nI then deleted the first line and removed static from everything ending up with\n\nprotected Var1 var1;\nprotected Var2 Var2;\nprotected Var3 Var3;\n\nThe strange thing about the diff is that it didn't completely delete the first line, but instead kept the protected on the first line and deleted it on the second line.\n\nI created a Repo to reproduce what I was seeing\nhttps://github.com/JasonMathison/BadDiff\n\ngit diff 76e4a079b5a985149ef09ebfd3df9f475d08fc93...4f8429ad13c4209ec375f67f60a3a797b6368088  --word-diff\ndiff --git a/code.java b/code.java\nindex d44a054..1118c6a 100644\n--- a/code.java\n+++ b/code.java\n@@ -1,4 +1,3 @@\nprotected[-static String deleteMe = \"I am going to be deleted\";-]\n[-protected static-] Var1 var1;\nprotected[-static-] Var2 Var2;\nprotected[-static-] Var3 Var3;\n\nMy suggestion is that the --word-diff prefer to remove an entire line in this situation.\n\n--Jason \n\n"}]}