summaryrefslogtreecommitdiff
path: root/contrib/diff-highlight/t
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-09-22 05:00:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-09-22 05:33:28 (GMT)
commit579789dbced8f9aee987fc4d609f5f92d32f9d26 (patch)
tree6e45528243fc21aa88b20bf01743eb40cfd9a350 /contrib/diff-highlight/t
parent47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc (diff)
downloadgit-579789dbced8f9aee987fc4d609f5f92d32f9d26.zip
git-579789dbced8f9aee987fc4d609f5f92d32f9d26.tar.gz
git-579789dbced8f9aee987fc4d609f5f92d32f9d26.tar.bz2
diff-highlight: correctly match blank lines for flush
We try to flush the output from diff-highlight whenever we see a blank line. That lets you see the output for each commit as soon as it is generated, even if Git is still chugging away at a diff, or traversing to find the next commit. However, our "blank line" match checks length($_). That won't ever be true, because we haven't chomped the line ending. As a result, we never flush. Instead, let's use a simple regex which handles line endings in with the end-of-line marker. This has been broken since the initial version in 927a13fe87 (contrib: add diff highlight script, 2011-10-18). Probably nobody noticed because: - most output is big enough, or comes fast enough, that it flushes anyway. And it can be difficult to notice the difference between "show a commit, then pause" and "pause, then show two commits". I only noticed because I was viewing "git log" output on a repo with a very slow textconv filter. - if stdout is going to the terminal (and not another pager like less), then the flush isn't necessary. So any manual testing would show it appearing to work. You can easily see the difference with something like: echo '* diff=slow' >>.gitattributes git -c diff.slow.textconv='sleep 1; cat' \ -c pager.log='diff-highlight | less' \ log -p That should generate one commit every second or so (more if it touches multiple files), but without this patch it waits for many seconds before generating several pages of output. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/diff-highlight/t')
0 files changed, 0 insertions, 0 deletions