From: Kenneth Lorber <keni@his.com>
To: git@vger.kernel.org
Cc: Kenneth Lorber <keni@his.com>, Patrick Steinhardt <ps@pks.im>,
Karthik Nayak <karthik.188@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: [RFC PATCH 0/1] config: surface editor failure in exit code
Date: Mon, 17 Aug 2026 17:19:32 -0400 [thread overview]
Message-ID: <20260817211936.2943278-1-keni@his.com> (raw)
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
next reply other threads:[~2026-08-17 21:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 21:19 Kenneth Lorber [this message]
2026-08-17 21:19 ` [RFC PATCH 1/1] config: surface editor failure in exit code Kenneth Lorber
2026-08-17 22:39 ` [RFC PATCH 0/1] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260817211936.2943278-1-keni@his.com \
--to=keni@his.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox