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

From: Eric Blake <[email-masked]>
Date: Mon, 08 Dec 2014 15:46:28 -0700

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