summaryrefslogtreecommitdiff
path: root/contrib/hg-to-git
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-02-13 22:32:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-02-13 23:57:06 (GMT)
commit097128d1bce7194702f336e30c5e228aa8ba774f (patch)
tree2ca8a1f734ebc257394df4d79d16a41076ef6617 /contrib/hg-to-git
parent2b21008d3c43d41588e84b45907bb8c2e86278f6 (diff)
downloadgit-097128d1bce7194702f336e30c5e228aa8ba774f.zip
git-097128d1bce7194702f336e30c5e228aa8ba774f.tar.gz
git-097128d1bce7194702f336e30c5e228aa8ba774f.tar.bz2
diff-highlight: don't highlight whole lines
If you have a change like: -foo +bar we end up highlighting the entirety of both lines (since the whole thing is changed). But the point of diff highlighting is to pinpoint the specific change in a pair of lines that are mostly identical. In this case, the highlighting is just noise, since there is nothing to pinpoint, and we are better off doing nothing. The implementation looks for "interesting" pairs by checking to see whether they actually have a matching prefix or suffix that does not simply consist of colorization and whitespace. However, the implementation makes it easy to plug in other heuristics, too, like: 1. Depending on the source material, the set of "boring" characters could be tweaked to include language-specific stuff (like braces or semicolons for C). 2. Instead of saying "an interesting line has at least one character of prefix or suffix", we could require that less than N percent of the line be highlighted. The simple "ignore whitespace, and highlight if there are any matched characters" implemented by this patch seems to give good results on git.git. I'll leave experimentation with other heuristics to somebody who has a dataset that does not look good with the current code. Based on an original idea and implementation by MichaƂ Kiedrowicz. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/hg-to-git')
0 files changed, 0 insertions, 0 deletions