]> git.ipfire.org Git - thirdparty/git.git/commitdiff
am: simplify prompt response handling
authorJeff King <peff@peff.net>
Mon, 20 May 2019 12:07:15 +0000 (08:07 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 May 2019 17:26:36 +0000 (10:26 -0700)
We'll never see a NULL returned from git_prompt(); if it can't produce
any input for us (e.g., because the terminal got EOF) then it will just
die().

So there's no need for us to handle NULL here. And even if there was, it
doesn't make sense to continue; on a true terminal hangup we'd just loop
infinitely trying to get input that will never come.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/am.c

index 58a2aef28bbcd715660422dc37042e79d4d350c1..56b17387772b03f3144511ecdb24851749746466 100644 (file)
@@ -1658,9 +1658,7 @@ static int do_interactive(struct am_state *state)
                 */
                reply = git_prompt(_("Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: "), PROMPT_ECHO);
 
-               if (!reply) {
-                       continue;
-               } else if (*reply == 'y' || *reply == 'Y') {
+               if (*reply == 'y' || *reply == 'Y') {
                        return 0;
                } else if (*reply == 'a' || *reply == 'A') {
                        state->interactive = 0;