From 4cd7cbcff3361f0b17db2627301cebc359e02150 Mon Sep 17 00:00:00 2001 From: Norbert Kiesel Date: Thu, 6 Oct 2016 15:32:50 -0700 Subject: [PATCH] diff: Warn about future change to default style diff still uses --normal as default diff style, although this is no longer recommended to be used and also actually mostly unused. Thus, futire versions of diff will switch to --unified as new default style. This commit only adds a warning informing users of that future change. --- NEWS | 7 +++++++ src/diff.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 473332e..ab66ffb 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ GNU diffutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + If the diff output style is not set, diff prints a warning that a future + release will switch the default output style from --normal to --unified. This + warning can be suppressed by setting the POSIXLY_CORRECT environment variable + (though that has some other side effects as well). + ** Bug fixes diff no longer mishandles line numbers exceeding 2**31 on Mingw-w64. diff --git a/src/diff.c b/src/diff.c index 686945e..12792a1 100644 --- a/src/diff.c +++ b/src/diff.c @@ -672,7 +672,12 @@ main (int argc, char **argv) context = 3; } else - specify_style (OUTPUT_NORMAL); + { + char const *t = getenv ("POSIXLY_CORRECT"); + if (!t) + error (0, 0, _("Future versions of diff will use --unified instead of --normal as default style")); + specify_style (OUTPUT_NORMAL); + } } if (output_style != OUTPUT_CONTEXT || hard_locale (LC_TIME)) -- 2.9.3