Code

index: be careful when handling long names
[git.git] / t / t9001-send-email.sh
index 659f9c758fd9abbae8aa657a4729059335dd92cd..4f6822f2c5d717edd20cb97e49fad3017d34897e 100755 (executable)
@@ -78,4 +78,34 @@ test_expect_success 'Show all headers' '
        diff -u expected-show-all-headers actual-show-all-headers
 '
 
+z8=zzzzzzzz
+z64=$z8$z8$z8$z8$z8$z8$z8$z8
+z512=$z64$z64$z64$z64$z64$z64$z64$z64
+test_expect_success 'reject long lines' '
+       rm -f commandline &&
+       cp $patches longline.patch &&
+       echo $z512$z512 >>longline.patch &&
+       ! git send-email \
+               --from="Example <nobody@example.com>" \
+               --to=nobody@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               $patches longline.patch \
+               2>errors &&
+       grep longline.patch errors
+'
+
+test_expect_success 'no patch was sent' '
+       ! test -e commandline
+'
+
+test_expect_success 'allow long lines with --no-validate' '
+       git send-email \
+               --from="Example <nobody@example.com>" \
+               --to=nobody@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               --no-validate \
+               $patches longline.patch \
+               2>errors
+'
+
 test_done