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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the user says `--no-ignore-space-change`, there's no need to
check for whitespace errors in the context lines.

Don't do it.

Signed-off-by: Rubén Justo <rjusto@xxxxxxxxx>
---
 apply.c                  | 3 ++-
 t/t4124-apply-ws-rule.sh | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

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);
 			break;
 		case '-':
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 573200da67..e12b8333c3 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -569,7 +569,8 @@ test_expect_success 'whitespace=fix honors no-ignore-whitespace' '
 	+A
 	 BZZ
 	EOF
-	git apply --no-ignore-whitespace --whitespace=fix patch
+	git apply --no-ignore-whitespace --whitespace=fix patch 2>error &&
+	test_must_be_empty error
 '
 
 test_expect_success 'whitespace check skipped for excluded paths' '
-- 
2.46.0.353.g385c909849




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux