diff --horizon-lines=lines

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Thu Jun 4 15:11:45 GMT 2020


On 2020-05-27 20:42, m@d m0nk via Cygwin wrote:
> On Thu, May 28, 2020 at 8:10 AM Eliot Moss wrote:
>> On 5/27/2020 10:27 PM, m@d m0nk via Cygwin wrote:
>>> I am trying to understand the practical use of "--horizon-lines=lines"
>>> option in the diff utility.
>>> Can i get some pointers on two sample files which can demonstrate the
>>> use of --horizon-lines=lines
>>> I understood the theory / definition from the info / man file.
>>> However, I am unable to reproduce the scenario.
>>> Request some pointers.

>> This stackexchange post may give some insight (it did for me):
>> https://unix.stackexchange.com/questions/158097/diff-horizon-lines-lines-explained
> Thanks EM.I did go through the post, I understood the concept/theory,
> but I am unable to do a practical demo of it. Do you have a sample
> file set for demo or can you suggest something?

The option --horizon-lines is intended to adjust (normally increase) the amount
of context kept for matching around a hunk of differences, independent of the
displayed context lines, before diff concludes that hunk is independent of any
subsequent changes and emit the hunk with
suppress-common-lines|--context|--unified lines of context around it.

Often a few blank (or other common text) lines will match any other range of a
few blank (or other common text) lines and diff will decide the hunk is
complete, so you may end up with a number of small separate added/deleted hunks,
rather than a larger hunk where some lines may have been changed.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in IEC units and prefixes, physical quantities in SI.]


More information about the Cygwin mailing list