git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 0/9] War on blank-at-eof
Date: Fri,  4 Sep 2009 03:55:09 -0700	[thread overview]
Message-ID: <1252061718-11579-1-git-send-email-gitster@pobox.com> (raw)

We had quite inconsistent handing of patches that add new blank lines at
the end of file, and this miniseries is about fixing it.

Patch 1 is a fix to an ancient bug introduced by v1.5.5-rc0~156^2~11.

Patch 2 fixes a bug that is even older---I suspect it dates back to the
very first change that introduced the feature, but I did not bother to
dig.

Patch 4 (Patch 3 is a preliminary refactoring used by it) is about the
discrepancy between "--whitespace=fix" and "--whitespace=warn".  The
blank-at-eof error was silently fixed but never diagnosed, which has
been one of the long-standing itch of mine to fix.

Patch 5 corrects the definition of blank-at-eof.  If a patch adds an
non-empty line that consists solely of whitespaces at the end of file, we
should diagnose and strip it just line a new empty line.  After all, both
are blank lines.

Patch 6 is a simple code reduction I noticed while preparing this series;
it can be a standalone patch, but it is obvious enough to be here.

Patches 7 and 8 address "git diff --check", which had roughly the same
logic as the --whitespace=fix.  It shared the same problems the earlier
parts of the series fixed for "git apply".

Patch 9 is about "diff --color" to paint blank-at-eof as error, which we
did not do so far because it was too cumbersome.  This has been another
one of the long-standing itch of mine to fix.

The series applies to v1.6.0.6-87-g82d97da; merging the result to 'master'
needs some conflict resolution.

 1 apply --whitespace=fix: fix handling of blank lines at the eof
 2 apply --whitespace=fix: detect new blank lines at eof correctly
 3 apply.c: split check_whitespace() into two
 4 apply --whitespace=warn/error: diagnose blank at EOF
 5 apply --whitespace: warn blank but not necessarily empty lines at EOF
 6 diff.c: the builtin_diff() deals with only two-file comparison
 7 diff --whitespace=warn/error: obey blank-at-eof
 8 diff --whitespace=warn/error: fix blank-at-eof check
 9 diff --color: color blank-at-eof

 Documentation/config.txt   |    2 +
 builtin-apply.c            |   61 +++++++++++++++-------
 cache.h                    |    3 +-
 diff.c                     |  119 +++++++++++++++++++++++++++++---------------
 t/t4015-diff-whitespace.sh |   11 +++-
 t/t4019-diff-wserror.sh    |   11 ++++-
 t/t4124-apply-ws-rule.sh   |   80 +++++++++++++++++++++++++++++
 ws.c                       |    6 ++
 8 files changed, 230 insertions(+), 63 deletions(-)

             reply	other threads:[~2009-09-04 10:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04 10:55 Junio C Hamano [this message]
2009-09-04 10:55 ` [PATCH 1/9] apply --whitespace=fix: fix handling of blank lines at the eof Junio C Hamano
2009-09-04 10:55 ` [PATCH 2/9] apply --whitespace=fix: detect new blank lines at eof correctly Junio C Hamano
2009-09-04 12:02   ` Johannes Sixt
2009-09-04 16:26     ` Junio C Hamano
2009-09-04 10:55 ` [PATCH 3/9] apply.c: split check_whitespace() into two Junio C Hamano
2009-09-04 10:55 ` [PATCH 4/9] apply --whitespace=warn/error: diagnose blank at EOF Junio C Hamano
2009-09-04 10:55 ` [PATCH 5/9] apply --whitespace: warn blank but not necessarily empty lines " Junio C Hamano
2009-09-04 10:55 ` [PATCH 6/9] diff.c: the builtin_diff() deals with only two-file comparison Junio C Hamano
2009-09-04 10:55 ` [PATCH 7/9] diff --whitespace=warn/error: obey blank-at-eof Junio C Hamano
2009-09-04 10:55 ` [PATCH 8/9] diff --whitespace=warn/error: fix blank-at-eof check Junio C Hamano
2009-09-04 10:55 ` [PATCH 9/9] diff --color: color blank-at-eof Junio C Hamano
2009-09-05 21:28 ` [PATCH 0/9] War on blank-at-eof Thell Fowler
2009-09-06  6:13   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252061718-11579-1-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).