From: Junio C Hamano <gitster@pobox.com>
To: "Björn Gustavsson" <bgustavsson@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] apply: Allow blank *trailing* context lines to match beyond EOF
Date: Wed, 07 Apr 2010 22:32:04 -0700 [thread overview]
Message-ID: <7vd3ya8q7f.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4BBD5827.7030003@gmail.com> ("Björn Gustavsson"'s message of "Thu\, 08 Apr 2010 06\:14\:31 +0200")
Björn Gustavsson <bgustavsson@gmail.com> writes:
> This patch should fix the problem observed by Junio, but note that
> there will be one or more blank lines left at the end of the
> file.
>
> I am not sure whether that should be fixed. In this particular
> case, the blank lines are part of the context but not part of
> the file being patched, so it could be argued that the blank
> lines should not be added back.
>
> But there are already other circumstances in which
> "--whitespace=fix" does not guarantee that the file does
> not end with blank lines, for instance if we have:
>
> a
> b
> (blank line)
> (blank line)
> (blank line)
> (blank line)
> c
> d
>
> and then delete the "c" and "d" lines:
>
> a
> b
> (blank line)
> (blank line)
> (blank line)
> (blank line)
Even though I think these are both worth fixing, I do not think it should
happen as part of this patch. Because the code that needs to "fix" the
"extra blank bug" this patch introduces will need to deal with exactly the
same horizon effect as your "deleting c and d at the end will not have the
blank immediately after b in the context" example, I expect we will fix
the fallout from this patch when we fix that "delete c and d at the end"
example.
prev parent reply other threads:[~2010-04-08 5:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 4:14 [PATCH] apply: Allow blank *trailing* context lines to match beyond EOF Björn Gustavsson
2010-04-08 5:32 ` Junio C Hamano [this message]
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=7vd3ya8q7f.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bgustavsson@gmail.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).