help-gnu-utils
[Top][All Lists]
Advanced

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

New feature for diffutils package


From: Марк Коренберг
Subject: New feature for diffutils package
Date: Thu, 1 Oct 2009 14:14:18 +0600

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

[Prev in Thread] Current Thread [Next in Thread]