diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2026-08-12 08:03:10 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-12 09:05:49 -0700 |
| commit | 633ac346eef2bd7f8b6e699f0298e87c2b8ed106 (patch) | |
| tree | 88c2b6e3053ee8fcc8244c2adce0b50f424290cd /t/t4013/diff.diff_initial..side | |
| parent | 93aab89509c1797b02d92bc924deed74b0feff86 (diff) | |
config: propagate launch_editor() failure in show_editor()
show_editor() calls launch_editor() to open the user's editor on
the configuration file, but discards the return value and
unconditionally returns 0 (success). When the editor fails to
launch (e.g., $EDITOR is not found, or the editor exits with a
nonzero status), the caller receives no indication that anything
went wrong.
This affects "git config edit" and "git config --edit": the
command silently succeeds even when the editor could not be
started. In contrast, other editor-launching paths in git (such
as "git commit" and "git rebase --edit-todo") properly propagate
editor failures and exit with an error.
Check the return value and propagate the failure by returning -1.
The two callers (cmd_config_edit at line 1315 and the legacy
cmd_config at line 1478) both propagate this return to
handle_builtin, which translates negative returns into an error
exit.
Pointed out by Coverity.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
