Merge branch 'jk/send-email-with-new-readline'
Adjust to newer Term::ReadLine to prevent it from breaking the interactive prompt code in send-email. * jk/send-email-with-new-readline: send-email: avoid creating more than one Term::ReadLine object send-email: drop FakeTerm hackmaint
						commit
						fc71d024ad
					
				|  | @ -26,18 +26,6 @@ use Git::I18N; | ||||||
|  |  | ||||||
| Getopt::Long::Configure qw/ pass_through /; | Getopt::Long::Configure qw/ pass_through /; | ||||||
|  |  | ||||||
| package FakeTerm; |  | ||||||
| sub new { |  | ||||||
| 	my ($class, $reason) = @_; |  | ||||||
| 	return bless \$reason, shift; |  | ||||||
| } |  | ||||||
| sub readline { |  | ||||||
| 	my $self = shift; |  | ||||||
| 	die "Cannot use readline on FakeTerm: $$self"; |  | ||||||
| } |  | ||||||
| package main; |  | ||||||
|  |  | ||||||
|  |  | ||||||
| sub usage { | sub usage { | ||||||
| 	print <<EOT; | 	print <<EOT; | ||||||
| git send-email' [<options>] <file|directory> | git send-email' [<options>] <file|directory> | ||||||
|  | @ -971,17 +959,19 @@ EOT3 | ||||||
| 	do_edit(@files); | 	do_edit(@files); | ||||||
| } | } | ||||||
|  |  | ||||||
| sub term { | { | ||||||
| 	my $term = eval { | 	# Only instantiate one $term per program run, since some | ||||||
|  | 	# Term::ReadLine providers refuse to create a second instance. | ||||||
|  | 	my $term; | ||||||
|  | 	sub term { | ||||||
| 		require Term::ReadLine; | 		require Term::ReadLine; | ||||||
| 		$ENV{"GIT_SEND_EMAIL_NOTTY"} | 		if (!defined $term) { | ||||||
| 			? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT) | 			$term = $ENV{"GIT_SEND_EMAIL_NOTTY"} | ||||||
| 			: Term::ReadLine->new('git-send-email'); | 				? Term::ReadLine->new('git-send-email', \*STDIN, \*STDOUT) | ||||||
| 	}; | 				: Term::ReadLine->new('git-send-email'); | ||||||
| 	if ($@) { | 		} | ||||||
| 		$term = FakeTerm->new("$@: going non-interactive"); | 		return $term; | ||||||
| 	} | 	} | ||||||
| 	return $term; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| sub ask { | sub ask { | ||||||
|  |  | ||||||
|  | @ -337,13 +337,14 @@ test_expect_success $PREREQ 'Show all headers' ' | ||||||
| test_expect_success $PREREQ 'Prompting works' ' | test_expect_success $PREREQ 'Prompting works' ' | ||||||
| 	clean_fake_sendmail && | 	clean_fake_sendmail && | ||||||
| 	(echo "to@example.com" && | 	(echo "to@example.com" && | ||||||
| 	 echo "" | 	 echo "my-message-id@example.com" | ||||||
| 	) | GIT_SEND_EMAIL_NOTTY=1 git send-email \ | 	) | GIT_SEND_EMAIL_NOTTY=1 git send-email \ | ||||||
| 		--smtp-server="$(pwd)/fake.sendmail" \ | 		--smtp-server="$(pwd)/fake.sendmail" \ | ||||||
| 		$patches \ | 		$patches \ | ||||||
| 		2>errors && | 		2>errors && | ||||||
| 		grep "^From: A U Thor <author@example.com>\$" msgtxt1 && | 		grep "^From: A U Thor <author@example.com>\$" msgtxt1 && | ||||||
| 		grep "^To: to@example.com\$" msgtxt1 | 		grep "^To: to@example.com\$" msgtxt1 && | ||||||
|  | 		grep "^In-Reply-To: <my-message-id@example.com>" msgtxt1 | ||||||
| ' | ' | ||||||
|  |  | ||||||
| test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' ' | test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' ' | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano