"git diff" surprising default output

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

 



Hello,

By default, 'git diff' produces an output that is often rather
surprising and difficult to grok, here is a simple example:

$ git diff --no-index -- f0.txt f1.txt
diff --git a/f0.txt b/f1.txt
index 3af00a929..35478f7bd 100644
--- a/f0.txt
+++ b/f1.txt
@@ -3,9 +3,6 @@
 #endif
 #if CANOPEN > 0
     IMD_CANOPEN,
-#endif
-#if MDL_LASER > 0
-    IMD_LASER,
 #endif
     IMD_AUTO,
     IMD_NONE,

I figured the offender is --indent-heuristic that is described in the
manual as:

      Enable the heuristic that shifts diff hunk boundaries to make
      patches easier to read. This is the default.

but apparently rather makes patches harder to read, at least at some
conditions. Turning it off helps to get the expected result:

$ git diff --no-index --no-indent-heuristic -- f0.txt f1.txt
diff --git a/f0.txt b/f1.txt
index 3af00a929..35478f7bd 100644
--- a/f0.txt
+++ b/f1.txt
@@ -4,9 +4,6 @@
 #if CANOPEN > 0
     IMD_CANOPEN,
 #endif
-#if MDL_LASER > 0
-    IMD_LASER,
-#endif
     IMD_AUTO,
     IMD_NONE,
     IMD_COUNT


Changing --diff-algorithm doesn't change the outcome.

So the questions are:

- Is there an example of an advantage the option has?

- Is it possible to flip the default?

Thanks,
-- Sergey Organov



[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