Suggestion for the --word-diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I ran into a situation where Git ends up giving a sort of strange diff in the --word-diff mode.

Starting with something like this

protected static String deleteMe = "I am going to be deleted";
protected static Var1 var1;
protected static Var2 Var2;
protected static Var3 Var3;

I then deleted the first line and removed static from everything ending up with

protected Var1 var1;
protected Var2 Var2;
protected Var3 Var3;

The 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.

I created a Repo to reproduce what I was seeing
https://github.com/JasonMathison/BadDiff

git diff 76e4a079b5a985149ef09ebfd3df9f475d08fc93...4f8429ad13c4209ec375f67f60a3a797b6368088  --word-diff
diff --git a/code.java b/code.java
index d44a054..1118c6a 100644
--- a/code.java
+++ b/code.java
@@ -1,4 +1,3 @@
protected[-static String deleteMe = "I am going to be deleted";-]
[-protected static-] Var1 var1;
protected[-static-] Var2 Var2;
protected[-static-] Var3 Var3;

My suggestion is that the --word-diff prefer to remove an entire line in this situation.

--Jason 





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux