Subject: Re: [PATCH] send-email: lazily assign editor variable

From: Uwe Kleine-König <[email-masked]>
Date: Mon, 22 Mar 2010 17:41:52 +0100

Hello Michael,

On Mon, Mar 22, 2010 at 05:12:53PM +0100, Michael J Gruber wrote:
> b4479f0 (add -i, send-email, svn, p4, etc: use "git var GIT_EDITOR",
> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to
> problems when send-mail is used without a tty.
> 
> Therefore, use git var GIT_EDITOR only when we actually edit something.
> 
> Signed-off-by: Michael J Gruber <[email-masked]>
> Reported-by: Uwe Kleine-König <[email-masked]>
> ---
>  git-send-email.perl |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index d612ae8..bb09c0d 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -162,9 +162,12 @@ my $compose_filename;
>  
>  # Handle interactive edition of files.
>  my $multiedit;
> -my $editor = Git::command_oneline('var', 'GIT_EDITOR');
> +my $editor;
>  
>  sub do_edit {
> +	if (!defined($editor)) {
> +		$editor = Git::command_oneline('var', 'GIT_EDITOR');
> +	}
>  	if (defined($multiedit) && !$multiedit) {
>  		map {
>  			system('sh', '-c', $editor.' "$@"', $editor, $_);
I havn't tested yet, but (maybe apart from a comment) this looks exactly
like the patch I would have done if I knew perl :-)

So, Acked-by: Uwe Kleine-König <[email-masked]>

Best regards and thanks for the quick response,
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |