On Wed, 12 May 2021 12:21 -0500, Felipe Contreras wrote:
The sole purpose of software is that it's useful to users. Software
that works today but not tomorrow is bad software.
The primary purpose of the testing framework is to ensure that doesn't
happen; that git keeps working in the same way today than it did
yesterday.
That's why it's more important that tests excercise the options people
were using yesterday.
In addition we also want to be testing new functionality, but that's *in
addition*.
Maybe at some point in the future more people will be using
--sendmail-cmd, but right now that's not the case. Right now we need to
be testing the option people are using *today*.
I agree with this completely. Is this requirement satisfied with the
addition of a test that checks the usage of an absolute path with
--smtp-server (the behavior that people were using yesterday), while all
of the existing tests are still converted to the new option? I have such
a test written (along with a few others) in the forthcoming v2 patch:
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 65b3035371..45bc3c0c4c 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2148,6 +2148,55 @@ test_expect_success $PREREQ 'leading and trailing
whitespaces are removed' '
test_cmp expected-list actual-list
'
+test_expect_success $PREREQ 'test using absolute path for --smtp-server' '
+ clean_fake_sendmail &&
+ git send-email \
+ --from="Example <nobody@xxxxxxxxxxx>" \
+ --to=nobody@xxxxxxxxxxx \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ HEAD^ &&
+ test_path_is_file commandline1
+'
+
+test_expect_success $PREREQ 'arguments not supported with --smtp-server' '
+ test_expect_code 127 git send-email \
+ --from="Example <nobody@xxxxxxxxxxx>" \
+ --to=nobody@xxxxxxxxxxx \
+ --smtp-server="$(pwd)/fake.sendmail -f nobody@xxxxxxxxxxx" \
+ HEAD^
+'
+
+test_expect_success $PREREQ 'test using command name with --sendmail-cmd' '
+ clean_fake_sendmail &&
+ PATH="$(pwd):$PATH" \
+ git send-email \
+ --from="Example <nobody@xxxxxxxxxxx>" \
+ --to=nobody@xxxxxxxxxxx \
+ --sendmail-cmd="fake.sendmail" \
+ HEAD^ &&
+ test_path_is_file commandline1
+'
+
+test_expect_success $PREREQ 'test using arguments with --sendmail-cmd' '
+ clean_fake_sendmail &&
+ git send-email \
+ --from="Example <nobody@xxxxxxxxxxx>" \
+ --to=nobody@xxxxxxxxxxx \
+ --sendmail-cmd="\"$(pwd)/fake.sendmail\" -f nobody@xxxxxxxxxxx" \
+ HEAD^ &&
+ test_path_is_file commandline1
+'
+
+test_expect_success $PREREQ 'test shell expression with --sendmail-cmd' '
+ clean_fake_sendmail &&
+ git send-email \
+ --from="Example <nobody@xxxxxxxxxxx>" \
+ --to=nobody@xxxxxxxxxxx \
+ --sendmail-cmd="[ 1 -eq 1 ] && \"$(pwd)/fake.sendmail\"" \
+ HEAD^ &&
+ test_path_is_file commandline1
+'
+
test_expect_success $PREREQ 'invoke hook' '
mkdir -p .git/hooks &&