{"thread":{"id":"22803","subject":"[PATCH v2 3/4] t4124: Add additional tests of --whitespace=fix","startedAt":"2010-02-24T19:24:30Z","lastAt":"2010-02-24T19:24:30Z","messageCount":1,"participants":["Björn Gustavsson"],"isPatch":true,"patchVersion":2,"patchTotal":4},"messages":[{"id":"135604","messageId":"4B857CEE.5090109@gmail.com","threadId":"22803","inReplyTo":null,"subject":"[PATCH v2 3/4] t4124: Add additional tests of --whitespace=fix","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-24T19:24:30Z","receivedAt":"2010-02-24T19:24:30Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\n t/t4124-apply-ws-rule.sh |   85 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 85 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh\nindex ca26397..c783710 100755\n--- a/t/t4124-apply-ws-rule.sh\n+++ b/t/t4124-apply-ws-rule.sh\n@@ -261,4 +261,89 @@ test_expect_success 'blank but not empty at EOF' '\n \tgrep \"new blank line at EOF\" error\n '\n \n+test_expect_success 'applying beyond EOF requires one non-blank context line' '\n+\t{ echo; echo; echo; echo; } >one &&\n+\tgit add one &&\n+\t{ echo b; } >>one &&\n+\tgit diff -- one >patch &&\n+\n+\tgit checkout one &&\n+\t{ echo a; echo; } >one &&\n+\tcp one expect &&\n+\ttest_must_fail git apply --whitespace=fix patch &&\n+\ttest_cmp one expect\n+'\n+\n+test_expect_success 'tons of blanks at EOF should not apply' '\n+\tfor i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do\n+\t\techo; echo; echo; echo;\n+\tdone >one &&\n+\tgit add one &&\n+\techo a >>one &&\n+\tgit diff -- one >patch &&\n+\n+\t>one &&\n+\ttest_must_fail git apply --whitespace=fix patch\n+'\n+\n+test_expect_success 'missing blank line at end with --whitespace=fix' '\n+\techo a >one &&\n+\techo >>one &&\n+\tgit add one &&\n+\techo b >>one &&\n+\tcp one expect &&\n+\tgit diff -- one >patch &&\n+\techo a >one &&\n+\ttest_must_fail git apply patch &&\n+\tgit apply --whitespace=fix patch &&\n+\ttest_cmp one expect\n+'\n+\n+test_expect_success 'two missing blank lines at end with --whitespace=fix' '\n+\t{ echo a; echo; echo b; echo c; } >one &&\n+\tcp one no-blank-lines &&\n+\t{ echo; echo; } >>one &&\n+\tgit add one &&\n+\techo d >>one &&\n+\tcp one expect &&\n+\techo >>one &&\n+\tgit diff -- one >patch &&\n+\tmv no-blank-lines one &&\n+\ttest_must_fail git apply patch &&\n+\tgit apply --whitespace=fix patch &&\n+\ttest_cmp one expect\n+'\n+\n+test_expect_success 'shrink file with tons of missing blanks at end of file' '\n+\t{ echo a; echo b; echo c; } >one &&\n+\tcp one no-blank-lines &&\n+\tfor i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do\n+\t\techo; echo; echo; echo;\n+\tdone >>one &&\n+\tgit add one &&\n+\techo a >one &&\n+\tcp one expect &&\n+\tgit diff -- one >patch &&\n+\tmv no-blank-lines one &&\n+\ttest_must_fail git apply patch &&\n+\tgit apply --whitespace=fix patch &&\n+\ttest_cmp one expect\n+'\n+\n+test_expect_success 'shrink file with tons of missing blanks at end of file' '\n+\t{ echo a; echo b; echo c; } >one &&\n+\tcp one no-blank-lines &&\n+\tfor i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do\n+\t\techo; echo; echo; echo;\n+\tdone >>one &&\n+\tgit add one &&\n+\techo a >one &&\n+\tcp one expect &&\n+\tgit diff -- one >patch &&\n+\tmv no-blank-lines one &&\n+\ttest_must_fail git apply patch &&\n+\tgit apply --whitespace=fix patch &&\n+\ttest_cmp one expect\n+'\n+\n test_done\n-- \n1.7.0\n"}]}