Re: [PATCH] diff --color-words -U0: fix the location of hunk headers
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 30, 2009, 17:32 UTC
- Message-ID
- <alpine.DEB.1.00.0910301831190.5383@felix-maschine>
- In-Reply-To
- <7v3a50n6hw.fsf@alter.siamese.dyndns.org>
Hi,
On Fri, 30 Oct 2009, Junio C Hamano wrote:
Show 15 quoted lines
> Markus Heidelberg <markus.heidelberg@web.de> writes:
>
> > 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.
Show 15 quoted lines
> 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