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

Re: [PATCH 2/5] apply: honor `ignore_ws_none` with `correct_ws_error`

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2024, 00:35 UTC
Message-ID
<xmqqseuqerb1.fsf@gitster.g>
In-Reply-To
<1eb33969-1739-4a27-a77b-3f4268f5519d@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 23 quoted lines
> 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?

Previous: Rubén JustoNext: Rubén Justo
Message 5 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.