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;