From patchwork Sat Nov 5 17:07:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= X-Patchwork-Id: 13033104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3855FC4332F for ; Sat, 5 Nov 2022 17:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbiKERIG (ORCPT ); Sat, 5 Nov 2022 13:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbiKERIC (ORCPT ); Sat, 5 Nov 2022 13:08:02 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD09AE021 for ; Sat, 5 Nov 2022 10:08:01 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id q71so6916418pgq.8 for ; Sat, 05 Nov 2022 10:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6w0mg27Ooq5/PSp06862M4FdMMwJ5+ojk2gqcT6CxaM=; b=WsqhkzPbmFQDXF51t5/TpkdAVJj7NU/cGjaiNFLyCbgpJskQaXfgOCijAhpm+YlQB6 66Bhf9KzlD+Ikq6crDfDwKL+BZ/JiFhgHmplUp8e3RZPPApB8UcKhytfWf4w+T5hBDH0 qdojeajw7iwbkgbfxGS4O9WbR7gj6+z20lMsmagQ76SLX8kVVw3llE84FvnXfk0lCOYt 3zVBqAWXc5B6+toNaJ2zMDJZBlrg5G3MPb+6Ke8Rdqowd0cHPTHKWZOl3JhCb76I20VY i4zR6nUWZMkCNFY7Arq91UdUdedb4dUKLnCLi8Rpf8d+bHDqfkF0ykPQ3sqVXDUiRmM4 AUDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6w0mg27Ooq5/PSp06862M4FdMMwJ5+ojk2gqcT6CxaM=; b=CMjUl3e1+YqMc6QCl8aIp2d2UV6eX8AD0OA9ZzpqH9hXyImIEeKDPCBczXpH/oI3Cf fUpf5VipWXsOA1BAHXyKhwmCeZ/iysi3Jt3jfkXlsgoYRNkYm1EWKs0eXmXO/4sscdLK Nwjlz/HIRCy+9xp86pAk2qwDVbukiDmncteT4NiyAkMyAPoxAb8CxBzC+DYGsvTqcROO 2kolRfsurJyTo7nak6SNUXvwC46OuHqOSiYA8pQ8wjDLRLcKMhXusMxyf02whEBoJI0Y fHXDRavT/jCiFiElf557t+enBZo3Uyd0ReMZM84Xa4e5y8135EFi7L6xL7o0RvHwcsNf 4FEQ== X-Gm-Message-State: ACrzQf2V8vPTpbnuVHzlLnCcZS87L0ykwJ0i0JatSOdypUASxiDqSsoi D8LorA9YplgvG09H97LVU8UbFNJ40PA= X-Google-Smtp-Source: AMsMyM4Y0t5X9lOBtgBInlr7ruhhZuzHHUxyJGxuZavwUM0x7z2l11O5JHQt/3tSAlj9DMiAoRMkNA== X-Received: by 2002:a05:6a00:846:b0:56e:42f7:dec with SMTP id q6-20020a056a00084600b0056e42f70decmr15083916pfk.65.1667668081051; Sat, 05 Nov 2022 10:08:01 -0700 (PDT) Received: from localhost.localdomain ([2001:ee0:500b:6370:da47:cda5:dbd5:6e77]) by smtp.gmail.com with ESMTPSA id c16-20020a056a00009000b0056299fd2ba2sm1513192pfj.162.2022.11.05.10.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:00 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?xJBvw6BuIFRy4bqnbiBD?= =?utf-8?b?w7RuZyBEYW5o?= Subject: [PATCH 02/13] bisect: refactor bisect_run() to match CodingGuidelines Date: Sun, 6 Nov 2022 00:07:33 +0700 Message-Id: X-Mailer: git-send-email 2.38.1.157.gedabe22e0a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Ævar Arnfjörð Bjarmason We didn't add "{}" to all "if/else" branches, and one "error" was mis-indented. Let's fix that first, which makes subsequent commits smaller. In the case of the "if" we can simply early return instead. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index d4d813ebfc..ee1197c8b2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1191,13 +1191,12 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) if (bisect_next_check(terms, NULL)) return BISECT_FAILED; - if (argc) - sq_quote_argv(&command, argv); - else { + if (!argc) { error(_("bisect run failed: no command provided.")); return BISECT_FAILED; } + sq_quote_argv(&command, argv); while (1) { res = do_bisect_run(command.buf); @@ -1268,7 +1267,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) res = BISECT_OK; } else if (res) { error(_("bisect run failed: 'git bisect--helper --bisect-state" - " %s' exited with error code %d"), new_state, res); + " %s' exited with error code %d"), new_state, res); } else { continue; }