Re: [PATCH v2 4/5] Make boundary characters for --color-words configurable

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v2 4/5] Make boundary characters for --color-words configurable

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:36

Jakub Narebski [off-list ref] writes:
quoted
To achieve the best, we have to find the pairs of lines (one minus and
one plus for each pair) which most match each other, and then do the
word diff for each pair.
Wouldn't be enough to treat run of plus/minus lines as a single block,
tokenize, do token-based (as opposed to line-based) diff, then show it
using linebreaks of the destination file (pluses line)?
I tried the "using linebreaks" but I discarded it because I did not think
it would work.  If we rewrite the last three lines above with this single
line:
Wouldn't be enough to use magic?
and apply that algorithm between the two, then we would get a long single
line that has words painted in red, two lines worth, followed by green "to
use magic?"  and finally an end-of-line.

Re: [PATCH v2 4/5] Make boundary characters for --color-words configurable

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:44:36

Junio C Hamano wrote:
Jakub Narebski [off-list ref] writes:
quoted
"Ping Yin" [off-list ref] writes:
quoted
To achieve the best, we have to find the pairs of lines (one minus and
one plus for each pair) which most match each other, and then do the
word diff for each pair.
Wouldn't be enough to treat run of plus/minus lines as a single block,
tokenize, do token-based (as opposed to line-based) diff, then show it
using linebreaks of the destination file (pluses line)?
I tried the "using linebreaks" but I discarded it because I did not think
it would work.  If we rewrite the last three lines above with this single
line:
quoted
Wouldn't be enough to use magic?
and apply that algorithm between the two, then we would get a long single
line that has words painted in red, two lines worth, followed by green "to
use magic?"  and finally an end-of-line.
It looks then like inserting (retaining?) newlines in word/token based
--color-words output isn't simple.  It would have to produce readable
output both for the case you stated/mentioned, and for the opposite case
(replacing single line by multiple lines).  What's even more difficult,
it should produce clear output for a simple case of rewrapping output,
e.g. the following as replacement.
quoted
Wouldn't be enough to treat run of plus/minus lines as a single
block, tokenize, do token-based (as opposed to line-based) diff,
then show it using linebreaks of the destination file (pluses
line)? 
Gaahh... I don't think this (word diff/token diff) is something computer
science has worked on?
-- 
Jakub Narebski
Poland

Re: [PATCH v2 4/5] Make boundary characters for --color-words configurable

From: Ping Yin <hidden>
Date: 2016-06-15 22:44:36

* Junio C Hamano [off-list ref] [2008-05-12 12:17:26 -0700]:
Jakub Narebski [off-list ref] writes:
quoted
quoted
To achieve the best, we have to find the pairs of lines (one minus and
one plus for each pair) which most match each other, and then do the
word diff for each pair.
Wouldn't be enough to treat run of plus/minus lines as a single block,
tokenize, do token-based (as opposed to line-based) diff, then show it
using linebreaks of the destination file (pluses line)?
I tried the "using linebreaks" but I discarded it because I did not think
it would work.  If we rewrite the last three lines above with this single
line:
quoted
Wouldn't be enough to use magic?
and apply that algorithm between the two, then we would get a long single
line that has words painted in red, two lines worth, followed by green "to
use magic?"  and finally an end-of-line.
That's why i said with current implementation we can't get the
best output which i think should be

Wouldn't be enough to {-treat run of plus/minus lines as a single block,}{+use magic?}
{-tokenize, do token-based (as opposed to line-based) diff, then show it}
{-using linebreaks of the destination file (pluses line)?}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help