git/xdiff
Antoine Pelisse 36617af7ed diff: add --ignore-blank-lines option
The goal of the patch is to introduce the GNU diff
-B/--ignore-blank-lines as closely as possible. The short option is not
available because it's already used for "break-rewrites".

When this option is used, git-diff will not create hunks that simply
add or remove empty lines, but will still show empty lines
addition/suppression if they are close enough to "valuable" changes.

There are two differences between this option and GNU diff -B option:
- GNU diff doesn't have "--inter-hunk-context", so this must be handled
- The following sequence looks like a bug (context is displayed twice):

    $ seq 5 >file1
    $ cat <<EOF >file2
    change
    1
    2

    3
    4
    5
    change
    EOF
    $ diff -u -B file1 file2
    --- file1	2013-06-08 22:13:04.471517834 +0200
    +++ file2	2013-06-08 22:13:23.275517855 +0200
    @@ -1,5 +1,7 @@
    +change
     1
     2
    +
     3
     4
     5
    @@ -3,3 +5,4 @@
     3
     4
     5
    +change

So here is a more thorough description of the option:
- real changes are interesting
- blank lines that are close enough (less than context size) to
interesting changes are considered interesting (recursive definition)
- "context" lines are used around each hunk of interesting changes
- If two hunks are separated by less than "inter-hunk-context", they
will be merged into one.

The implementation does the "interesting changes selection" in a single
pass.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-19 15:17:45 -07:00
..
xdiff.h diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xdiffi.c diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xdiffi.h diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xemit.c diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xemit.h diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xhistogram.c Correct common spelling mistakes in comments and tests 2013-04-12 13:38:40 -07:00
xinclude.h War on whitespace 2007-06-07 00:04:01 -07:00
xmacros.h xdiff: cast arguments for ctype functions to unsigned char 2010-10-06 10:46:45 -07:00
xmerge.c xdiff: cast arguments for ctype functions to unsigned char 2010-10-06 10:46:45 -07:00
xpatience.c xdiff: PATIENCE/HISTOGRAM are not independent option bits 2012-02-19 15:36:55 -08:00
xprepare.c xdiff: PATIENCE/HISTOGRAM are not independent option bits 2012-02-19 15:36:55 -08:00
xprepare.h War on whitespace 2007-06-07 00:04:01 -07:00
xtypes.h War on whitespace 2007-06-07 00:04:01 -07:00
xutils.c diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00
xutils.h diff: add --ignore-blank-lines option 2013-06-19 15:17:45 -07:00