Subject: Re: [PATCH v3 3/3] diff: define block by number of non-space chars

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Aug 2017 12:54:22 -0700

Jonathan Tan <[email-masked]> writes:

> The existing behavior of diff --color-moved=zebra does not define the
> minimum size of a block at all, instead relying on a heuristic applied
> later to filter out sets of adjacent moved lines that are shorter than 3
> lines long. This can be confusing, because a block could thus be colored
> as moved at the source but not at the destination (or vice versa),
> depending on its neighbors.
>
> Instead, teach diff that the minimum size of a block is 10
> non-whitespace characters. This allows diff to still exclude
> uninteresting lines appearing on their own (such as those solely
> consisting of one or a few closing braces), as was the intention of the
> adjacent-moved-line heuristic.

I recall that there is a logic backed by a similar rationale in
blame.c::blame_entry_score() but over there we count alnum, not
!isspace, to judge if a block has been split into too small a piece
to be significant.  I do not know which one is better, but if there
is no strong reason, perhaps we want to unify the two, so that we
can improve both heuristics at the same time?