From: "Björn Gustavsson" <bgustavsson@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add a test for a problem in "rebase --whitespace=fix"
Date: Sun, 7 Feb 2010 23:44:20 +0100 [thread overview]
Message-ID: <6672d0161002071444lba0f751w3e7e33043e1ec2e8@mail.gmail.com> (raw)
In-Reply-To: <7vtytsevsd.fsf@alter.siamese.dyndns.org>
2010/2/7 Junio C Hamano <gitster@pobox.com>:
> First, is this a condition that we want to change the behaviour to
> "succeed" later?
Yes, assuming it is possible to fix.
> Imagine that the gap between abc and def block in your example is much
> larger to exceed the number of pre-context lines of your second patch
> (usually 3), and imagine you are the "git apply --whitespace=fix" program
> you have updated to "fix" the preceived problem. You know you earlier
> might have stripped some blank lines at the EOF, but there is nothing that
> tells you if you had only 3 blank lines, or you had even more. How many
> blank lines will you be adding back?
My original idea was to add back exactly the number of lines needed
so that the context lines would match. That can be calculated from
the line numbers of the last line of the pre-image and the line number
in the chunk and by scanning the chunk for blank context lines
(both at the beginning and end of chunk). Since the blanks lines
at the end will be stripped away anyway, I doesn't matter if I add
back fewer lines than were there originally.
Thinking a little more about it, if there is a chunk that starts
beyond the end of file, I could add the number of blanks lines
that is missing up to the beginning of the chunk plus the
number of lines in the chunk itself. That will also take
care of the case that the chunk deletes blanks lines.
(That will probably add too many blanks at the end,
but they will be stripped out again.)
That is my plan. Of course, since I have not attempted
to implement it yet, there could be fatal flaws in it.
Do you see any fatal flaws that I don't see?
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
next prev parent reply other threads:[~2010-02-07 22:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-07 8:10 [PATCH] Add a test for a problem in "rebase --whitespace=fix" Björn Gustavsson
2010-02-07 18:38 ` Junio C Hamano
2010-02-07 22:44 ` Björn Gustavsson [this message]
2010-02-08 0:15 ` Junio C Hamano
2010-02-08 7:37 ` Björn Gustavsson
2010-02-09 21:58 ` Junio C Hamano
2010-02-10 20:20 ` Björn Gustavsson
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=6672d0161002071444lba0f751w3e7e33043e1ec2e8@mail.gmail.com \
--to=bgustavsson@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).