`git diff --ignore-space-at-eol` will ignore whitespace at the
line ends.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
On Tue, 13 Feb 2007, Timur Tabi wrote:
> Junio C Hamano wrote:
>
> > You could revert the change to the editor configuration and
> > rely on "git diff" before committing to point out the
> > whitespace breakage that you newly introduced to the file.
> > Then you would be sending out exactly what you changed.
>
> Thanks, but I was hoping that git would make my life easier, not
> more difficult.
Strictly speaking, you made life difficult on git by asking your
editor to edit text it should not edit.
However, this was a nice late-night exercise.
diff.c | 2 ++
xdiff/xdiff.h | 3 ++-
xdiff/xutils.c | 24 ++++++++++++++++++++++++
3 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/diff.c b/diff.c
index d712181..815a7a8 100644
--- a/diff.c
+++ b/diff.c
@@ -2059,6 +2059,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->xdl_opts |= XDF_IGNORE_WHITESPACE;
else if (!strcmp(arg, "-b") || !strcmp(arg, "--ignore-space-change"))
options->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
+ else if (!strcmp(arg, "--ignore-space-at-eol"))
+ options->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
else if (!strcmp(arg, "--color-words"))
options->color_diff = options->color_diff_words = 1;
else if (!strcmp(arg, "--no-renames"))
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index fa409d5..e874a7c 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -31,7 +31,8 @@ extern "C" {
#define XDF_NEED_MINIMAL (1 << 1)
#define XDF_IGNORE_WHITESPACE (1 << 2)
#define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3)
-#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE)
+#define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4)
+#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL)
...