apply --whitespace=fix: detect new blank lines at eof correctly
[gitweb.git] / t / t4124-apply-ws-rule.sh
index 6898722f2e2309d04d2875597386e3cc9829b28c..fedc8b9277778064e558a3d2fad90e330b035085 100755 (executable)
@@ -177,4 +177,28 @@ test_expect_success 'blank at EOF with --whitespace=fix (2)' '
        test_cmp expect one
 '
 
+test_expect_success 'blank at EOF with --whitespace=fix (3)' '
+       { echo a; echo b; echo; } >one &&
+       git add one &&
+       { echo a; echo c; echo; } >expect &&
+       { cat expect; echo; echo; } >one &&
+       git diff -- one >patch &&
+
+       git checkout one &&
+       git apply --whitespace=fix patch &&
+       test_cmp expect one
+'
+
+test_expect_success 'blank at end of hunk, not at EOF with --whitespace=fix' '
+       { echo a; echo b; echo; echo; echo; echo; echo; echo d; } >one &&
+       git add one &&
+       { echo a; echo c; echo; echo; echo; echo; echo; echo; echo d; } >expect &&
+       cp expect one &&
+       git diff -- one >patch &&
+
+       git checkout one &&
+       git apply --whitespace=fix patch &&
+       test_cmp expect one
+'
+
 test_done