From dbd1dd759bbaa92ea9cd1534ec75f488fbf11860 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 7 Mar 2019 23:37:23 +0100 Subject: [PATCH] built-in add -i: offer the `quit` command We do not really want to `exit()` here, of course, as this is safely libified code. Signed-off-by: Johannes Schindelin --- add-interactive.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/add-interactive.c b/add-interactive.c index 000b07c47d..7bc999e929 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -992,10 +992,11 @@ int run_add_i(struct repository *r, const struct pathspec *ps) add_untracked = { { "add untracked" }, run_add_untracked }, patch = { { "patch" }, run_patch }, diff = { { "diff" }, run_diff }, + quit = { { "quit" }, NULL }, help = { { "help" }, run_help }; struct command_item *commands[] = { &status, &update, &revert, &add_untracked, - &patch, &diff, &help + &patch, &diff, &quit, &help }; struct print_file_item_data print_file_item_data = { @@ -1040,7 +1041,8 @@ int run_add_i(struct repository *r, const struct pathspec *ps) for (;;) { i = list_and_choose((struct prefix_item **)commands, NULL, ARRAY_SIZE(commands), &s, &main_loop_opts); - if (i == LIST_AND_CHOOSE_QUIT) { + if (i == LIST_AND_CHOOSE_QUIT || + (i != LIST_AND_CHOOSE_ERROR && !commands[i]->command)) { printf(_("Bye.\n")); res = 0; break;