Thread (2 messages) flat view 2 messages, 2 authors, 2024-08-29

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

From: Junio C Hamano <hidden>
Date: 2024-08-27 00:35:19

Rubén Justo [off-list ref] writes:
quoted hunk
Ensure strict matching of context lines when applying with
`--whitespace=fix` combined with `--no-ignore-whitespace`.

Signed-off-by: Rubén Justo <redacted>
---
 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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help