git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] apply: whitespace errors in context lines if we have

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2024, 00:51 UTC
Message-ID
<xmqqbk1eeqk0.fsf@gitster.g>
In-Reply-To
<5da09529-e95b-407b-9e66-34ebac4b4128@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
> If the user says `--no-ignore-space-change`, there's no need to
> check for whitespace errors in the context lines.

Because the default is *not* to ignore space change, the command should behave exactly the same way between two cases: (1) the user uses the default and does not give the "--ignore-space-change" option, and (2) the user gives the "--no-ignore-space-change" option explicitly. So I am very much convinced that [1/5] is unneeded, and "If the user says `--no-*`" in the above proposed log message is insufficient (at least it also needs to say "or uses the default and does not say "--ignore-space-change").

> Don't do it.

No need to say this, when the paragraphs above clearly and unambiguously leads to this conclusion.

Show 12 quoted lines
> diff --git a/apply.c b/apply.c
> index 0cb9d38e5a..e1b4d14dba 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -1734,7 +1734,8 @@ static int parse_fragment(struct apply_state *state,
>  			trailing++;
>  			check_old_for_crlf(patch, line, len);
>  			if (!state->apply_in_reverse &&
> -			    state->ws_error_action == correct_ws_error)
> +			    state->ws_error_action == correct_ws_error &&
> +			    state->ws_ignore_action != ignore_ws_none)
>  				check_whitespace(state, line, len, patch->ws_rule);

I am not 100% convinced that this change is _wrong_, but it does smell like reverting a necessary change as I pointed out in another reply.

Thanks.
Previous: Junio C HamanoNext: Rubén Justo
Message 15 of 18 in “`--whitespace=fix` with `--no-ignore-whitespace`”
  1. 0/5 `--whitespace=fix` with `--no-ignore-whitespace`Rubén Justo, Aug 25, 2024
  2. 1/5 apply: introduce `ignore_ws_default`Rubén Justo, Aug 25, 2024
  3. Junio C HamanoAug 27, 2024
  4. 2/5 apply: honor `ignore_ws_none` with `correct_ws_error`Rubén Justo, Aug 25, 2024
  5. Junio C HamanoAug 27, 2024
  6. Rubén JustoAug 29, 2024
  7. Junio C HamanoAug 29, 2024
  8. Rubén JustoSep 3, 2024
  9. Junio C HamanoSep 4, 2024
  10. Rubén JustoSep 4, 2024
  11. 3/5 apply: whitespace errors in context lines if we haveRubén Justo, Aug 25, 2024
  12. Junio C HamanoAug 27, 2024
  13. Junio C HamanoAug 27, 2024
  14. Junio C HamanoAug 27, 2024
  15. Junio C HamanoAug 27, 2024
  16. 4/5 apply: error message in `record_ws_error()`Rubén Justo, Aug 25, 2024
  17. Junio C HamanoAug 27, 2024
  18. 5/5 t4124: move test preparation into the test contextRubén Justo, Aug 25, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.