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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin, 29.10.2009:
> Hi,
> 
> On Thu, 29 Oct 2009, Markus Heidelberg wrote:
> 
> > Indeed my initial fix was in the same fashion:
> > 
> > @@ -772,6 +772,15 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
> >         }
> > 
> >         if (line[0] == '@') {
> > +               if (ecbdata->diff_words) {
> > +                       /*
> > +                        * The content of the previous hunk, necessary for
> > +                        * 0-context.
> > +                        */
> > +                       if (ecbdata->diff_words->minus.text.size ||
> > +                           ecbdata->diff_words->plus.text.size)
> > +                               diff_words_show(ecbdata->diff_words);
> > +               }
> >                 len = sane_truncate_line(ecbdata, line, len);
> >                 find_lno(line, ecbdata);
> >                 emit_line(ecbdata->file,
> > 
> > But then I thought I should not put the diff output from --color-words
> > into the block that deals with the hunk header, but save another place
> > where diff_words_show() is called.
> 
> I found this paragraph, as well as the patches 2/3 and 3/3, hard to 
> follow.

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.

But I'm not sure what's the better way and am content with either.

> And besides, flushing in that block is the correct thing to do.  The 
> function diff_words_show() is a function for that exact purpose.

Yes, 2/3 and 3/3 just don't introduce a new invocation of this function
at another place in the code.

Markus

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]