When comparing some C or Bash sources with diff -u, diff assume some lines
in the middle of the hunk as common.

For example
 qqqq
 www
 eeee
-text1
+text3
 common1
-text4
+text5
 aaa
 bbb
 cccc

I'm talking about  line "common1".  One frequent situation is that diff
assume lines "fi", "}", "{", "else" as common lines. In the middle of the
patch it's not always good for reading result.
In all those cases, it is appropriate to remove this line (mark with "-" )
in old place and than add it ( mark with "+" ) in new place. In other words,
i want new option:

-O regex.
Lines in the middle of the hunk, matched this regex will be considered
different if it really equal.

Diff should not think, that "fi", "}", "{", "else" is good context in
resulting patches.

Other option, that will solve my problem too -- "do not allow less than n
lines of context".

Correct patch after specifying such options should be:

 qqqq
 www
 eeee
-text1
-common1
-text4
+text3
+common1
+text5
 aaa
 bbb
 cccc

The most frequent situation when part of one function moved to another
function placed near old.


-- 
Segmentation fault

Reply via email to