Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-05-13 04:21:58 +0300
committerJunio C Hamano <gitster@pobox.com>2015-05-13 06:25:08 +0300
commitcb64800d83ace6fecb8701151cfdb6ed0712702c (patch)
tree230d77a33004a6cbf1417f99025cd04546c694e2 /builtin/add.c
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
add: check return value of launch_editor
When running "add -e", if launching the editor fails, we do not notice and continue as if the output is what the user asked for. The likely case is that the editor did not touch the contents at all, and we end up adding everything. Reported-by: Russ Cox <rsc@golang.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 459208a326..1c7436589e 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -207,7 +207,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);