[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diff -b does not actually work with newlines
From: |
David Kastrup |
Subject: |
diff -b does not actually work with newlines |
Date: |
Fri, 13 Jul 2007 11:21:47 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux) |
diff the following files using
diff -b a b
file a:
This is a test file
and we are testing
file b:
This is
a test file and we are testing
You get:
diff -b a b
1,2c1,2
< This is a test file
< and we are testing
---
> This is
> a test file and we are testing
This is quite a big nuisance since "soft newlines" are rather common
in a lot of source code languages. Being able to keep hard newlines
(double empty lines) for comparison might be a nice option for things
like TeX input, but that is not crucial for now.
At the moment, I think it quite important that diff indeed is able to
discard hunks which differ only in whitespace _including_ newlines.
One will likely have to keep track of offsets introduced by discarded
hunks which is sort of a problem (one can't make a patch that will
apply in both directions without offsets when discarding hunks of
different size). But that problem should like already exist with the
-B flag, and so it is likely not really critical.
This is
diff (GNU diffutils) 2.8.1
Copyright (C) 2002 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
--
David Kastrup