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

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

From
Kenneth Lorber <keni@his.com>
Date
Aug 19, 2026, 15:09 UTC
Message-ID
<20260819150922.2984850-2-keni@his.com>
In-Reply-To
<20260819150922.2984850-1-keni@his.com>

Teach git config --edit to show editor failure to the parent process.

Add 2 tests to t1300 to check editor exiting successfully or failing.

Signed-off-by: Kenneth Lorber <keni@his.com>
---
 builtin/config.c  |  5 +++--
 t/t1300-config.sh | 12 ++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index 0882899c3f..a166b2131e 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -1291,6 +1291,7 @@ static int cmd_config_remove_section(int argc, const char **argv, const char *pr
 static int show_editor(struct config_location_options *opts)
 {
 	char *config_file;
+	int ret;
 
 	if (!opts->source.file && !startup_info->have_repository)
 		die(_("not in a git directory"));
@@ -1313,10 +1314,10 @@ static int show_editor(struct config_location_options *opts)
 		else if (errno != EEXIST)
 			die_errno(_("cannot create configuration file %s"), config_file);
 	}
-	launch_editor(config_file, NULL, NULL);
+	ret = launch_editor(config_file, NULL, NULL);
 	free(config_file);
 
-	return 0;
+	return ret;
 }
 
 static int cmd_config_edit(int argc, const char **argv, const char *prefix,
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index e3f8064889..3e218079ee 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1823,6 +1823,18 @@ test_expect_success 'command line overrides environment config' '
 	test_cmp expect actual
 '
 
+test_expect_success 'git config -e successful exit' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	test_env GIT_EDITOR=true git -C repo config -e
+'
+
+test_expect_success 'git config -e failure exit' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	test_env GIT_EDITOR=false test_must_fail git -C repo config -e
+'
+
 test_expect_success 'git config --edit works' '
 	git config -f tmp test.value no &&
 	echo test.value=yes >expect &&
-- 
2.43.0
Previous: Kenneth LorberNext: Kenneth Lorber
Message 11 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.