Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] diff --color-words -U0: fix the location of hunk headers

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:47:38

Possibly related (same subject, not in this thread)

Hi,

On Fri, 30 Oct 2009, Junio C Hamano wrote:
Markus Heidelberg [off-list ref] writes:
quoted
I try to reword:
With 2/3 and 3/3 I wanted to keep --color-words specific code in the
block starting with

	if (ecbdata->diff_words) {

and didn't want to contaminate the block starting with

	if (line[0] == '@') {

with non-hunk-header content.
The contamination was already done long time ago.
Actually, it was don on purpose.
quoted hunk ↗ jump to hunk
diff --git a/diff.c b/diff.c
index b7ecfe3..8c66e4a 100644
--- a/diff.c
+++ b/diff.c
@@ -541,14 +541,18 @@ struct emit_callback {
 	FILE *file;
 };
 
+/* In "color-words" mode, show word-diff of words accumulated in the buffer */
+static void diff_words_flush(struct emit_callback *ecbdata)
+{
+	if (ecbdata->diff_words->minus.text.size ||
+	    ecbdata->diff_words->plus.text.size)
+		diff_words_show(ecbdata->diff_words);
+}
Instead of this function, you can check the same at the beginning of 
diff_words_show().

The reason I did not do that was to avoid a full subroutine call, as I 
expected this code path to be very expensive.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help