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

[RFC/PATCH 2/3] t4124: Add additional tests of --whitespace=fix

From
Björn Gustavsson <bgustavsson@gmail.com>
Date
Feb 17, 2010, 07:03 UTC
Message-ID
<4B7B94BE.60502@gmail.com>

"git apply --whitespace=fix" must not succeed unless at least one context line falls within the boundaries of the file.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
 t/t4124-apply-ws-rule.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index ca26397..3b539d8 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -261,4 +261,16 @@ test_expect_success 'blank but not empty at EOF' '
 	grep "new blank line at EOF" error
 '
 
+test_expect_success 'tons of blanks at EOF should not apply' '
+	for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
+		echo; echo; echo; echo;
+	done >one &&
+	git add one &&
+	echo a >>one &&
+	git diff -- one >patch &&
+
+	>one &&
+	test_must_fail git apply --whitespace=fix patch
+'
+
 test_done
-- 
1.7.0
Message 1 of 1 in “t4124: Add additional tests of --whitespace=fix”
  1. 2/3 t4124: Add additional tests of --whitespace=fixBjörn Gustavsson, Feb 17, 2010

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.