Skip to content
  • Antoine Pelisse's avatar
    diff: add --ignore-blank-lines option · 36617af7
    Antoine Pelisse authored and Junio C Hamano's avatar Junio C Hamano committed
    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 d...
    36617af7