diff: disable compaction heuristic for now
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Jun 2016 17:58:55 +0000 (10:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Jun 2016 20:45:23 +0000 (13:45 -0700)
http://lkml.kernel.org/g/20160610075043.GA13411@sigill.intra.peff.net
reports that a change to add a new "function" with common ending
with the existing one at the end of the file is shown like this:

def foo
do_foo_stuff()

+ common_ending()
+end
+
+def bar
+ do_bar_stuff()
+
common_ending()
end

when the new heuristic is in use. In reality, the change is to add
the blank line before "def bar" and everything below, which is what
the code without the new heuristic shows.

Disable the heuristics by default, and resurrect the documentation
for the option and the configuration variables, while clearly
marking the feature as still experimental.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/diff-config.txt
Documentation/diff-options.txt
diff.c
index 6eaa45271c9ff2d1200e4299c3040d52952a2ec4..6fb70c5d437d2318417d174b891d94d05677e259 100644 (file)
@@ -166,6 +166,11 @@ diff.tool::
 
 include::mergetools-diff.txt[]
 
+diff.compactionHeuristic::
+       Set this option to `true` to enable an experimental heuristic that
+       shifts the hunk boundary in an attempt to make the resulting
+       patch easier to read.
+
 diff.algorithm::
        Choose a diff algorithm.  The variants are as follows:
 +
index 3ad6404dbcf2915721ac963085bbc0269c1d7312..9baf1ad277884dba36ffff9ff0e914c50c78b855 100644 (file)
@@ -63,6 +63,13 @@ ifndef::git-format-patch[]
        Synonym for `-p --raw`.
 endif::git-format-patch[]
 
+--compaction-heuristic::
+--no-compaction-heuristic::
+       These are to help debugging and tuning an experimental
+       heuristic (which is off by default) that shifts the hunk
+       boundary in an attempt to make the resulting patch easier
+       to read.
+
 --minimal::
        Spend extra time to make sure the smallest possible
        diff is produced.
diff --git a/diff.c b/diff.c
index 05ca3ce08e21082f66ea9a8c6d0b51d1e56c6815..9116d9d1c792d66350abc4bc86cf8d5866be5fc7 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -25,7 +25,7 @@
 #endif
 
 static int diff_detect_rename_default;
-static int diff_compaction_heuristic = 1;
+static int diff_compaction_heuristic; /* experimental */
 static int diff_rename_limit_default = 400;
 static int diff_suppress_blank_empty;
 static int diff_use_color_default = -1;