From: Junio C Hamano Date: Fri, 5 Jun 2015 19:00:09 +0000 (-0700) Subject: Merge branch 'jk/add-e-kill-editor' into maint X-Git-Tag: v2.4.3~20 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8d5ef5a0d1da18a2eb55c976720a8e96642c1b0b?hp=a3821a1ae5580ac9788d866c292376070d3e5133 Merge branch 'jk/add-e-kill-editor' into maint "git add -e" did not allow the user to abort the operation by killing the editor. * jk/add-e-kill-editor: add: check return value of launch_editor --- diff --git a/builtin/add.c b/builtin/add.c index 3390933d68..4bd98b799e 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -208,7 +208,8 @@ static int edit_patch(int argc, const char **argv, const char *prefix) if (run_diff_files(&rev, 0)) die(_("Could not write patch")); - launch_editor(file, NULL, NULL); + if (launch_editor(file, NULL, NULL)) + die(_("editing patch failed")); if (stat(file, &st)) die_errno(_("Could not stat '%s'"), file); diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh index 4ee47cc9a8..3cb74ca296 100755 --- a/t/t3702-add-edit.sh +++ b/t/t3702-add-edit.sh @@ -118,4 +118,11 @@ test_expect_success 'add -e' ' ' +test_expect_success 'add -e notices editor failure' ' + git reset --hard && + echo change >>file && + test_must_fail env GIT_EDITOR=false git add -e && + test_expect_code 1 git diff --exit-code +' + test_done