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

Kenneth Lorber <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
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.

This patch simply passes the returned error out of show_editor(), which
currently has an unconditional "return 0" even though its callers
both check the return value.

While this didn't trigger anything in 'make test', it's possible that
someone is relying on 'git config -e' always succeeding, even if the
editor failed, so this could be considered a breaking change.

The 2 new tests set GIT_EDITOR to true and false and check the return
from git.

RFC because the community may not want to change this behavior and
I'm not thrilled with my test code.

Kenneth Lorber (1):
  config: surface editor failure in exit code

 builtin/config.c  |  5 +++--
 t/t1300-config.sh | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)


base-commit: 010afd3166ddc64c9863b1506f12cbcdda0d4ea1
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.