editor.c: Libify launch_editor()

This patch removes exit()/die() calls and builtin-specific messages
from launch_editor(), so that it can be used as a general libgit.a
function to launch an editor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stephan Beyer
2008-07-25 18:28:42 +02:00
committed by Junio C Hamano
parent d82f33e20d
commit 7198203ae3
4 changed files with 23 additions and 15 deletions

View File

@ -646,7 +646,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
char index[PATH_MAX];
const char *env[2] = { index, NULL };
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
launch_editor(git_path(commit_editmsg), NULL, env);
if (launch_editor(git_path(commit_editmsg), NULL, env)) {
fprintf(stderr,
"Please supply the message using either -m or -F option.\n");
exit(1);
}
}
if (!no_verify &&