From patchwork Wed Sep 8 15:24:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12481351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24D71C433FE for ; Wed, 8 Sep 2021 15:24:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00D236115C for ; Wed, 8 Sep 2021 15:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348652AbhIHPZo (ORCPT ); Wed, 8 Sep 2021 11:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348669AbhIHPZj (ORCPT ); Wed, 8 Sep 2021 11:25:39 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A6C1C06175F for ; Wed, 8 Sep 2021 08:24:31 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id m25-20020a7bcb99000000b002e751bcb5dbso1851696wmi.5 for ; Wed, 08 Sep 2021 08:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R4WEpNsRtGsOLPdzFG29r+7FZrBMrdX51URTaA1o6hg=; b=SsRzU5CGz70NwTJyJCa2pTGulaQ0CzoTv+wliqlR3ANbgHxfn++YtLtmBY0idJAklO dw1o5BvDRS3ytgemKPVhG2/vta+sW7wXOpqgLgEAM15ox+gFIpRUrhUFJ1WjnPxJiGDj Ft3k2Cfgtr7Nc/nRoYyiRj3jHUjkR7T/bYEWNTpUb0ozXZYrGTU+HVB9DqnUGM7pIgNI ws/0jOfLWhNjXvh4rNO9dZdiP/vJJsHl2yMomfHbTAJSoZbJVstPrFjqzuy/8fBD1n3O Xa3CJAGtzF5SrIIt/w+N4XiHJk/3ZVrgr0lDK9KOfxzxpJa0sVhBqS8DSINyQic2WX2v FNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R4WEpNsRtGsOLPdzFG29r+7FZrBMrdX51URTaA1o6hg=; b=SqgG5WrGIpsxDSie5O8Xcnh0cdKNs18pVGWjqvVyattV38iAT16F8r9xNSwUNbnJcM k6zBC7+kqhJBDx8nC/XxFC2PrHBmk4KsdD2BWzXerS7eshlRWoD+Mt+/+guWUyz1cy9E udi5htIeH34Ky2dMhsNcJ1YQaH+mPC9wFmWyk0Qe5nLnAIT+1ohvoNLHP9eUjituzyEl yC+mKG11aAxFUpjIzwSg+1l+9Aoz/sAz3R03J1QyVIYXfIHRkzATQrALOBp0YreGLjNq pkco4VIhre61lPC7uVRytgtPJWRoGmOxAZMj6FpqajuS7hcixXE3G1f6t8HdCDHWivLB csog== X-Gm-Message-State: AOAM533SneRfa/hA1Ar2GhGC58pvY+PeLSarow5JEXGRBJkDXyIAcaUc uU60MYZEHKLsnitLgetL69CNuYHkymzAgg== X-Google-Smtp-Source: ABdhPJzosTPbk0yL50i2TtUzBL4rF7it8vIOPm24A9Kj2PnV1HTwgBf2AwJUB1d8RLIitpCtC8bvKQ== X-Received: by 2002:a05:600c:2114:: with SMTP id u20mr4233418wml.65.1631114669852; Wed, 08 Sep 2021 08:24:29 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x21sm2365240wmi.15.2021.09.08.08.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 08:24:29 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Philip Oakley , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= , =?utf-8?q?SZEDER_G=C3=A1bor?= , =?utf-8?b?w4Z2YXIg?= =?utf-8?b?QXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 4/6] help: refactor "for_human" control flow in cmd_help() Date: Wed, 8 Sep 2021 17:24:20 +0200 Message-Id: X-Mailer: git-send-email 2.33.0.825.g2bf60429931 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Instead of having two lines that call list_config_help(for_human) let's setup the pager and print the trailer conditionally. This makes it clearer at a glance how the two differ in behavior. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/help.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/builtin/help.c b/builtin/help.c index 0f9dc31c40f..0737b22069b 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -574,13 +574,12 @@ int cmd_help(int argc, const char **argv, const char *prefix) if (show_config) { int for_human = show_config == 1; - if (!for_human) { - list_config_help(for_human); - return 0; - } - setup_pager(); + if (for_human) + setup_pager(); list_config_help(for_human); - printf("\n%s\n", _("'git help config' for more information")); + if (for_human) + printf("\n%s\n", _("'git help config' for more information")); + return 0; }