Skip to content

Commit

Permalink
Merge branch 'jk/add-e-kill-editor' into maint
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Jun 5, 2015
2 parents a3821a1 + cb64800 commit 8d5ef5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions t/t3702-add-edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8d5ef5a

Please sign in to comment.