@@ -992,10 +992,11 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
992
992
add_untracked = { { "add untracked" }, run_add_untracked },
993
993
patch = { { "patch" }, run_patch },
994
994
diff = { { "diff" }, run_diff },
995
+ quit = { { "quit" }, NULL },
995
996
help = { { "help" }, run_help };
996
997
struct command_item * commands [] = {
997
998
& status , & update , & revert , & add_untracked ,
998
- & patch , & diff , & help
999
+ & patch , & diff , & quit , & help
999
1000
};
1000
1001
1001
1002
struct print_file_item_data print_file_item_data = {
@@ -1040,7 +1041,8 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
1040
1041
for (;;) {
1041
1042
i = list_and_choose ((struct prefix_item * * )commands , NULL ,
1042
1043
ARRAY_SIZE (commands ), & s , & main_loop_opts );
1043
- if (i == LIST_AND_CHOOSE_QUIT )
1044
+ if (i == LIST_AND_CHOOSE_QUIT ||
1045
+ (i != LIST_AND_CHOOSE_ERROR && !commands [i ]-> command )) {
1044
1046
printf (_ ("Bye.\n" ));
1045
1047
res = 0 ;
1046
1048
break ;
0 commit comments