From: "Rubén Justo" <rjusto@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 2/5] apply: honor `ignore_ws_none` with `correct_ws_error`
Date: Thu, 29 Aug 2024 07:07:53 +0200 [thread overview]
Message-ID: <afade304-51e3-441d-9ae6-e0a422d00bc4@gmail.com> (raw)
In-Reply-To: <xmqqseuqerb1.fsf@gitster.g>
On Mon, Aug 26, 2024 at 05:35:14PM -0700, Junio C Hamano wrote:
> Rubén Justo <rjusto@gmail.com> writes:
>
> > Ensure strict matching of context lines when applying with
> > `--whitespace=fix` combined with `--no-ignore-whitespace`.
> >
> > Signed-off-by: Rubén Justo <rjusto@gmail.com>
> > ---
> > apply.c | 3 ++-
> > t/t4124-apply-ws-rule.sh | 27 +++++++++++++++++++++++++++
> > 2 files changed, 29 insertions(+), 1 deletion(-)
> >
> > diff --git a/apply.c b/apply.c
> > index 63e58086f1..0cb9d38e5a 100644
> > --- a/apply.c
> > +++ b/apply.c
> > @@ -2596,7 +2596,8 @@ static int match_fragment(struct apply_state *state,
> > goto out;
> > }
> >
> > - if (state->ws_error_action != correct_ws_error) {
> > + if (state->ws_error_action != correct_ws_error ||
> > + state->ws_ignore_action == ignore_ws_none) {
> > ret = 0;
> > goto out;
> > }
>
> Hmph, if we are correcting for whitespace violations, even if
> whitespace fuzz is not allowed externally, wouldn't the issue that
> c1beba5b (git-apply --whitespace=fix: fix whitespace fuzz introduced
> by previous run, 2008-01-30) corrected still apply? IOW, isn't this
> change introducing a regression when an input touches a file with a
> change with broken whitespaces, and then touches the same file to
> replace the broken whitespace lines with something else?
Yes, that is the center of the blast this series is producing;
affecting to what `--whitespace=fix` does (just a reminder for other
readers):
- stop fixing whitespace errors in context lines and
- no longer warning about them.
Clearly, as you point out, the change poses a problem when applying
changes with whitespace errors in lines involved multiple times,
either during the same apply session or across multiple sessions
executed in sequence.
The new `ignore_ws_default` enum option is intended to mitigate the
blast. It would be unexpected IMHO for someone who wants the behavior
described in c1beba5b to be indicating `--no-ignore-whitespace`. And
with it we allow the possibility for someone who finds that behavior
undesirable to avoid it.
I'm not very happy with the new enum, but I haven't come up with a
better idea. There are other alternatives:
--whitespace=fix-strict
--do-not-fix-ws-errors-in-context-lines
None of them are better, I think.
next prev parent reply other threads:[~2024-08-29 5:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-25 10:09 [PATCH 0/5] `--whitespace=fix` with `--no-ignore-whitespace` Rubén Justo
2024-08-25 10:17 ` [PATCH 1/5] apply: introduce `ignore_ws_default` Rubén Justo
2024-08-27 1:11 ` Junio C Hamano
2024-08-25 10:18 ` [PATCH 2/5] apply: honor `ignore_ws_none` with `correct_ws_error` Rubén Justo
2024-08-27 0:35 ` Junio C Hamano
2024-08-29 5:07 ` Rubén Justo [this message]
2024-08-29 23:13 ` Junio C Hamano
2024-09-03 22:06 ` Rubén Justo
2024-09-04 4:41 ` Junio C Hamano
2024-09-04 18:20 ` Rubén Justo
2024-08-25 10:18 ` [PATCH 3/5] apply: whitespace errors in context lines if we have Rubén Justo
2024-08-27 0:43 ` Junio C Hamano
2024-08-27 1:49 ` Junio C Hamano
2024-08-27 16:12 ` Junio C Hamano
2024-08-27 0:51 ` Junio C Hamano
2024-08-25 10:19 ` [PATCH 4/5] apply: error message in `record_ws_error()` Rubén Justo
2024-08-27 0:44 ` Junio C Hamano
2024-08-25 10:19 ` [PATCH 5/5] t4124: move test preparation into the test context Rubén Justo
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=afade304-51e3-441d-9ae6-e0a422d00bc4@gmail.com \
--to=rjusto@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).