Re: [PATCH v3] Make git send-email accept $EDITOR with arguments
- From
Gustaf Hendeby <hendeby@isy.liu.se>
- Date
- Dec 22, 2007, 08:47 UTC
- Message-ID
- <476CCF36.3010109@isy.liu.se>
- In-Reply-To
- <7vr6hf35fh.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 34 quoted lines
> Gustaf Hendeby <hendeby@isy.liu.se> 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 <hendeby@isy.liu.se>
>> ---
>>
>> 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