git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rebase -i: print the editor name if it fails to launch

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 20, 2009, 18:44 UTC
Message-ID
<7v4onlbi3q.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B2DE132.1080700@gmail.com>
Björn Gustavsson <bgustavsson@gmail.com> writes:
Show 8 quoted lines
> I am not sure whether "git am" also should be modified
> to call git_editor_error_string. Currently it ignores
> any errors from the call to git_editor. Should it abort
> if there is an error or should it print a warning like this
>
> echo "Warning: $(git_editor_error_string)"
>
> if the editor fails to launch?

It probably is better, even though the lack of check there is not as harmful compared to the one in "rebase -i" that annoyed you (which I also see occasionally after freshly rebooting my environment, as I use emacsclient like you do). You will be taken back to the "what now?" interactive loop and have a chance to \C-c out of it. So such a patch would help not in the sense that it would prevent the command from doing what you didn't intend to (which is your "rebase -i" patch is about), but in the sense that it hints what needs to be fixed once you break out of the command.

> -		git_editor "$TODO" ||
> -			die_abort "Could not execute editor"
> +		git_editor "$TODO" || die_abort "$(git_editor_error_string)"

Isn't this too elaborate? git_editor() has already run and when it attempted to launch the editor it assigned to GIT_EDITOR in order to use it as an eval string.

    git_editor "$TODO" ||
    die_abort "Failed to run '${GIT_EDITOR:-your editor}'"
would suffice, no?

The alternative string is for a case where "git var" gave an empty string, or GIT_EDITOR was an empty string from the beginning.

Previous: Björn GustavssonNext: Björn Gustavsson
Message 3 of 4 in “rebase -i: print the editor name if it fails to launch”
  1. rebase -i: print the editor name if it fails to launchBjörn Gustavsson, Dec 20, 2009
  2. Björn GustavssonDec 20, 2009
  3. Junio C HamanoDec 20, 2009
  4. Björn GustavssonDec 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.