Re: [PATCH v4] Teach git var about GIT_EDITOR
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 1, 2009, 04:29 UTC
- Message-ID
- <7vocnm3m14.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091031075627.GB635@progeny.tock>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Expose the command used by launch_editor() for scripts to use. > This should allow one to avoid searching for a proper editor > separately in each command.
Ok, so the idea is...
* git_editor(void) uses the logic to decide which editor to use that used to live in launch_editor(). The function returns NULL if there is no suitable editor; the caller is expected to issue an error message when appropriate.
* launch_editor() uses git_editor() and gives the error message the same way as before when EDITOR is not set.
* "git var GIT_EDITOR" gives the editor name, or an error message when there is no appropriate one.
* "git var -l" gives GIT_EDITOR=name only if there is an appropriate editor.
The above all look sensible, but IIRC, the true "vi" fell back on "ex" mode on dumb terminals and was usable as a line editor, so we should be able to run it even on dumb terminals. I do not know about vi-clones though.