Skip to content

Commit 5580b27

Browse files
committed
diff: disable compaction heuristic for now
http://lkml.kernel.org/g/[email protected] 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 <[email protected]>
1 parent 77085a6 commit 5580b27

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Documentation/diff-config.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ diff.tool::
166166

167167
include::mergetools-diff.txt[]
168168

169+
diff.compactionHeuristic::
170+
Set this option to `true` to enable an experimental heuristic that
171+
shifts the hunk boundary in an attempt to make the resulting
172+
patch easier to read.
173+
169174
diff.algorithm::
170175
Choose a diff algorithm. The variants are as follows:
171176
+

Documentation/diff-options.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ ifndef::git-format-patch[]
6363
Synonym for `-p --raw`.
6464
endif::git-format-patch[]
6565

66+
--compaction-heuristic::
67+
--no-compaction-heuristic::
68+
These are to help debugging and tuning an experimental
69+
heuristic (which is off by default) that shifts the hunk
70+
boundary in an attempt to make the resulting patch easier
71+
to read.
72+
6673
--minimal::
6774
Spend extra time to make sure the smallest possible
6875
diff is produced.

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif
2626

2727
static int diff_detect_rename_default;
28-
static int diff_compaction_heuristic = 1;
28+
static int diff_compaction_heuristic; /* experimental */
2929
static int diff_rename_limit_default = 400;
3030
static int diff_suppress_blank_empty;
3131
static int diff_use_color_default = -1;

0 commit comments

Comments
 (0)