Subject: Re: [PATCH v3] Make git send-email accept $EDITOR with arguments

From: Gustaf Hendeby <[email-masked]>
Date: Sat, 22 Dec 2007 09:47:50 +0100

Junio C Hamano wrote:
> Gustaf Hendeby <[email-masked]> writes:
> 
>> Currently git send-email does not accept $EDITOR with arguments, eg,
>> emacs -nw, when starting an editor to produce a cover letter.  This
>> patch changes this by letting the shell handle the option parsing.
>>
>> Signed-off-by:  Gustaf Hendeby <[email-masked]>
>> ---
>>
>> This is based on Junio's suggestion on most readable and compatible
>> solution.  I'm not sure if it is identical to the C solution for git
>> tag, but it seems to be a reasonable solution.
>>
>>  git-send-email.perl |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 248d035..e47994a 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -400,7 +400,7 @@ EOT
>>  	close(C);
>>  
>>  	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
>> -	system($editor, $compose_filename);
>> +	system('sh', '-c', '$0 $@', $editor, $compose_filename);
>>  
>>  	open(C2,">",$compose_filename . ".final")
>>  		or die "Failed to open $compose_filename.final : " . $!;
>> -- 
>> 1.5.4.rc1.16.gc817f
> 
> Thanks.  Has this been tested?  IOW, did you compose this
> message with this patch?

Yes, I sent out the patch with git send-email, with git including the 
patch itself and EDITOR=emacsclient -a emacs.  I have also played around 
with it a bit trying to make sure it is valid, but no more rigorous 
testing that that.  I'm not really sure how I would do that.

Thanks for all comments from everyone, I have learned a lot!

/Gustaf