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

Re: [RFC PATCH 0/1] config: surface editor failure in exit code

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 17, 2026, 22:39 UTC
Message-ID
<xmqqse4c2wyu.fsf@gitster.g>
In-Reply-To
<20260817211936.2943278-1-keni@his.com>
Kenneth Lorber <keni@his.com> writes:
Show 10 quoted lines
> When the editor invoked by 'git config -e' fails (crashes or calls exit(3)
> with a non-zero value), git notices and give an error:
> 	editor.c:launch_specified_editor()
> 		return error("there was a problem with the editor '%s'", editor);
> which is then lost:
> 	builtin/config.c:show_editor()
> 		launch_editor(config_file, NULL, NULL);
> which results in git always calling exit(0).  Note that the value is
> not explicitly thrown away with "(void)", so this may not have been
> intentional.

I do not intentionally exit my editor with a non-zero status myself, but what I hear from others who do is that they do so to affect the invoking 'git' command, e.g., to stop 'git commit' from creating a commit. They somehow realize they botched the edit, and they want to prevent 'git commit' from committing, signaling that by exiting their editor. A cleaner and more modern way to do so, by the way, is to empty the editor buffer. In either case, 'git commit' itself exits with a non-zero status.

It might have been more consistent if 'git config -e' exited with a non-zero status when it noticed that the editor exited with a non-zero status, in that sense. But we have never done so, and that is probably because we did not care ;-)

In any case, I am not sure whether there is much value in making 'git config -e' start behaving that way. Even if it can notice a failed editor, the damage to the file is already done, and there is not enough information to undo the damage even if you wanted to when detecting such an error. This is quite different from when an editor edits the 'COMMIT_EDITMSG' file and fails.

So, I dunno.
Previous: Junio C HamanoNext: Karthik Nayak
Message 6 of 16 in “config: surface editor failure in exit code”
  1. 0/1 config: surface editor failure in exit codeKenneth Lorber, Aug 17, 2026
  2. 1/1 config: surface editor failure in exit codeKenneth Lorber, Aug 17, 2026
  3. Karthik NayakAug 18, 2026
  4. Kenneth LorberAug 19, 2026
  5. Junio C HamanoAug 19, 2026
  6. Junio C HamanoAug 17, 2026
  7. Karthik NayakAug 18, 2026
  8. Junio C HamanoAug 18, 2026
  9. brian m. carlsonAug 18, 2026
  10. 0/1 config: surface editor failure in exit codeKenneth Lorber, Aug 19, 2026
  11. 1/1 config: surface editor failure in exit codeKenneth Lorber, Aug 19, 2026
  12. 0/1 config: surface editor failure in exit codeKenneth Lorber, Aug 19, 2026
  13. 1/1 config: surface editor failure in exit codeKenneth Lorber, Aug 19, 2026
  14. Junio C HamanoAug 19, 2026
  15. Kenneth LorberAug 19, 2026
  16. Junio C HamanoAug 19, 2026

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.