Thread (64 messages) flat view 64 messages, 5 authors, 2016-06-15

Re: [PATCHv2 8/8] send-email: do not prompt for explicit repo ident

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:55:17

Jeff King wrote:
quoted hunk ↗ jump to hunk
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -191,15 +191,47 @@ test_expect_success $PREREQ 'Show all headers' '
 
 test_expect_success $PREREQ 'Prompting works' '
 	clean_fake_sendmail &&
-	(echo "Example <from@example.com>"
-	 echo "to@example.com"
+	(echo "to@example.com"
 	 echo ""
 	) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
 		--smtp-server="$(pwd)/fake.sendmail" \
 		$patches \
 		2>errors &&
+		grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
+		grep "^To: to@example.com\$" msgtxt1
+'
The indentation seems strange here --- are the new "grep" lines
continuations of the git send-email line?

It's probably easier to change the structure completely:

	clean_fake_sendmail &&
	echo to@examples.com >prompt.input &&
	echo >>prompt.input &&
	GIT_SEND_EMAIL_NOTTY=1 \
		git send-email --smtp-server=... $patches <prompt.input &&
	grep "^From: A U Thor [off-list ref]\$" msgtxt1 &&
	grep "^To: to@example.com\$" msgtxt1
+test_expect_success $PREREQ,AUTOIDENT 'implicit ident prompts for sender' '
+	clean_fake_sendmail &&
+	(echo "Example [off-list ref]" &&
+	 echo "to@example.com" &&
+	 echo ""
+	) |
+	(sane_unset GIT_AUTHOR_NAME &&
+	 sane_unset GIT_AUTHOR_EMAIL &&
+	 sane_unset GIT_COMMITTER_NAME &&
+	 sane_unset GIT_COMMITTER_EMAIL &&
+	 GIT_SEND_EMAIL_NOTTY=1 git send-email \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		$patches \
+		2>errors &&
 		grep "^From: Example [off-list ref]\$" msgtxt1 &&
 		grep "^To: to@example.com\$" msgtxt1
+	)
+'
Likewise:

	clean_fake_sendmail &&
	echo "Example [off-list ref]" >prompt.in &&
	echo to@example.com >>prompt.in
	echo >>prompt.in &&
	(
		sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
		sane_unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL &&
		GIT_SEND_EMAIL_NOTTY=1 \
			git send-email --smtp-server=... $patches <prompt.in
	) &&
	grep "^From: Example [off-list ref]\$" msgtxt1 &&
	grep "^To: to@example.com\$" msgtxt1
+test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' '
+	clean_fake_sendmail &&
+	(sane_unset GIT_AUTHOR_NAME &&
+	 sane_unset GIT_AUTHOR_EMAIL &&
+	 sane_unset GIT_COMMITTER_NAME &&
+	 sane_unset GIT_COMMITTER_EMAIL &&
+	 GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY &&
+	 test_must_fail git send-email \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		$patches </dev/null 2>errors.out &&
+		test_i18ngrep "tell me who you are" errors.out
+	)
 '
Likewise:

	clean_fake_sendmail &&
	(
		sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
		sane_unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL &&
		GIT_SEND_EMAIL_NOTTY=1 \
			git send-email --smtp-server=... $patches </dev/null 2>err
	) &&
	test_i18ngrep "[Tt]ell me who you are" err

For what it's worth, with or without such changes,
Acked-by: Jonathan Nieder <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help