Skip to content

Commit 2e33d35

Browse files
committed
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 <[email protected]>
1 parent 5235122 commit 2e33d35

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

add-interactive.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,11 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
985985
add_untracked = { { "add untracked" }, run_add_untracked },
986986
patch = { { "patch" }, run_patch },
987987
diff = { { "diff" }, run_diff },
988+
quit = { { "quit" }, NULL },
988989
help = { { "help" }, run_help };
989990
struct command_item *commands[] = {
990991
&status, &update, &revert, &add_untracked,
991-
&patch, &diff, &help
992+
&patch, &diff, &quit, &help
992993
};
993994

994995
struct print_file_item_data print_file_item_data = {
@@ -1033,7 +1034,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
10331034
for (;;) {
10341035
i = list_and_choose((struct prefix_item **)commands, NULL,
10351036
ARRAY_SIZE(commands), &s, &main_loop_opts);
1036-
if (i < -1) {
1037+
if (i < -1 || (i >= 0 && !commands[i]->command)) {
10371038
printf(_("Bye.\n"));
10381039
res = 0;
10391040
break;

0 commit comments

Comments
 (0)