Subject: Re: bug#19319: ? Unexpected behavior in diff(1)

From: Todd Shandelman <[email-masked]>
Date: Mon, 8 Dec 2014 17:50:38 -0600

Thanks.
Well, I must say that is all rather counter-intuitive.
I never dreamed that the amount of context I select would actually affect
the diff itself and how it is computed.
But if you say so, I guess that is how it works.
Todd

On 8 December 2014 at 16:46, Eric Blake <[email-masked]> wrote:

> On 12/08/2014 03:27 PM, Todd Shandelman wrote:
> > With -U1 and -U2 , the --ignore-matching-lines='Id' argument suppresses
> > display of the difference between the 'Id' lines, as expected.
>
> At that (small) level of context, the hunk containing the 'Id' line is
> separate from the remaining hunks, so the hunk is omitted.
>
> >
> > But with -U3, the diff of the 'Id' lines reappears,  in spite of the
> > --ignore-matching-lines='Id'
> > argument.
> >
> > Why is that?
>
> As soon as you have enough context, the hunk for the 'Id' line is the
> SAME hunk as the rest of the changes.  --ignore-matching-lines omits a
> hunk only if the entire hunk matches the regex; but as soon as you have
> other changes, then the entire hunk is output verbatim.
>
> --ignore-matching-lines does NOT ignore individual lines within a hunk,
> but only a hunk at a time.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>