Skip to content
Snippets Groups Projects
Commit 3774e1453ef4 authored by Patrick Mezard's avatar Patrick Mezard
Browse files

diff: --ignore-blank-lines was too enthusiastic

It was ignoring changes from:

ab

to:

a
b
parent 00276525e2b7
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@
text = re.sub('[ \t\r]+', ' ', text)
text = text.replace(' \n', '\n')
if blank and opts.ignoreblanklines:
text = re.sub('\n+', '', text)
text = re.sub('\n+', '\n', text).strip('\n')
return text
def diffline(revs, a, b, opts):
......
......@@ -442,3 +442,16 @@
New line not noticed when space change ignored:
$ hg ndiff --ignore-blank-lines --ignore-all-space
Do not ignore all newlines, only blank lines
$ printf 'hello \nworld\ngoodbye world\n' > foo
$ hg ndiff --ignore-blank-lines
diff -r 540c40a65b78 foo
--- a/foo
+++ b/foo
@@ -1,2 +1,3 @@
-hello world
+hello
+world
goodbye world
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment