From patchwork Mon May 20 12:07:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 10950979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77FDA933 for ; Mon, 20 May 2019 12:07:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 665CA287C2 for ; Mon, 20 May 2019 12:07:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AD8628812; Mon, 20 May 2019 12:07:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8A6F287F3 for ; Mon, 20 May 2019 12:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732559AbfETMHT (ORCPT ); Mon, 20 May 2019 08:07:19 -0400 Received: from cloud.peff.net ([104.130.231.41]:33806 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1730534AbfETMHS (ORCPT ); Mon, 20 May 2019 08:07:18 -0400 Received: (qmail 23166 invoked by uid 109); 20 May 2019 12:07:17 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Mon, 20 May 2019 12:07:17 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 3604 invoked by uid 111); 20 May 2019 12:07:57 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.94) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) SMTP; Mon, 20 May 2019 08:07:57 -0400 Authentication-Results: peff.net; auth=none Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Mon, 20 May 2019 08:07:15 -0400 Date: Mon, 20 May 2019 08:07:15 -0400 From: Jeff King To: Alejandro Sanchez Cc: git@vger.kernel.org Subject: [PATCH 1/4] am: simplify prompt response handling Message-ID: <20190520120715.GA11212@sigill.intra.peff.net> References: <20190520120636.GA12634@sigill.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190520120636.GA12634@sigill.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- builtin/am.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index 912d9821b1..644bb11f6c 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1661,9 +1661,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;