Skip to contentSkip to conversation

t4124: Add additional tests of --whitespace=fix

PATCH In review Björn Gustavsson 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

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

---
 t/t4124-apply-ws-rule.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
t/t4124-apply-ws-rule.sh +12 -0
index ca26397..3b539d8 100755
@@ -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
Signature · 1 line
1.7.0