Skip to content

Commit

Permalink
diff: disable compaction heuristic for now
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gitster committed Jun 10, 2016
1 parent 77085a6 commit 5580b27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Documentation/diff-config.txt
Expand Up @@ -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:
+
Expand Down
7 changes: 7 additions & 0 deletions Documentation/diff-options.txt
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion diff.c
Expand Up @@ -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;
Expand Down

0 comments on commit 5580b27

Please sign in to comment.