summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/add.c3
-rwxr-xr-xt/t3702-add-edit.sh7
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ee370b0..df5135b 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -209,7 +209,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 4ee47cc..3cb74ca 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