Commit Graph

5 Commits

Author SHA1 Message Date
Patrick Mezard
a884b59cee mdiff: adjust hunk offsets with --ignore-blank-lines (issue3234)
When diffing the following documents with --ignore-blank-lines (-B):

  $ cat > a <<EOF
  >
  >
  >
  > b
  > x
  > d
  > EOF

and:

  $ cat > b <<EOF
  > b
  > y
  > d
  > EOF

the context lines are taken from the first document, even if the lines differ
(with -w or -b) or if the number of lines differ (with -B). In the second case,
we have to adjust the hunk new lines offsets or we end with inconsistent diffs
like (see the @@ offsets):

  diff -r 0e66aa54f318 a
  --- a/a
  +++ b/a
  @@ -1,4 +1,3 @@

   b
  -x
  +y
   d

Note that having different context lines in a and b means the diff can be
applied but is not invertible.

Reported by Nicholas Riley <com-selenic@sabi.net>
2012-02-06 21:17:50 +01:00
Patrick Mezard
16811ddcba diff: --ignore-blank-lines was too enthusiastic
It was ignoring changes from:

ab

to:

a
b
2011-11-13 21:37:14 +01:00
Mads Kiilerich
635406bf76 tests: use (esc) for all non-ASCII test output 2010-11-08 01:41:41 +01:00
Mads Kiilerich
35ef3c1409 mdiff: carriage return (\r) is also ignorable whitespace 2010-10-19 03:55:06 +02:00
Adrian Buehlmann
84dc4ff5aa tests: unify test-diff-ignore-whitespace 2010-08-30 23:13:52 +02:00