diff --git a/add-patch.c b/add-patch.c index 447e8166d24f43..0997d4af7398a2 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1668,7 +1668,7 @@ static int patch_update_file(struct add_p_state *s, } } else if (s->answer.buf[0] == 'p') { rendered_hunk_index = -1; - } else if (s->answer.buf[0] == '?') { + } else { const char *p = _(help_patch_remainder), *eol = p; color_fprintf(stdout, s->s.help_color, "%s", @@ -1692,9 +1692,6 @@ static int patch_update_file(struct add_p_state *s, color_fprintf_ln(stdout, s->s.help_color, "%.*s", (int)(eol - p), p); } - } else { - err(s, _("Unknown command '%s' (use '?' for help)"), - s->answer.buf); } } diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index ed7e414649ca1d..04d833337342cf 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -8,8 +8,6 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh -SP=" " - diff_cmp () { for x do @@ -58,19 +56,6 @@ test_expect_success 'warn about add.interactive.useBuiltin' ' done ' -test_expect_success 'unknown command' ' - test_when_finished "git reset --hard; rm -f command" && - echo W >command && - git add -N command && - git diff command >expect && - cat >>expect <<-EOF && - (1/1) Stage addition [y,n,q,a,d,e,p,?]? Unknown command ${SQ}W${SQ} (use ${SQ}?${SQ} for help) - (1/1) Stage addition [y,n,q,a,d,e,p,?]?$SP - EOF - git add -p -- command actual 2>&1 && - test_cmp expect actual -' - test_expect_success 'setup (initial)' ' echo content >file && git add file && @@ -247,6 +232,7 @@ test_expect_success 'setup file' ' ' test_expect_success 'setup patch' ' + SP=" " && NULL="" && cat >patch <<-EOF @@ -1,4 +1,4 @@