From patchwork Sat Nov 5 17:07:32 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: 13033103 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 86716C433FE for ; Sat, 5 Nov 2022 17:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbiKERIF (ORCPT ); Sat, 5 Nov 2022 13:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiKERIA (ORCPT ); Sat, 5 Nov 2022 13:08:00 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50820DFCC for ; Sat, 5 Nov 2022 10:07:59 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so6979533pjd.4 for ; Sat, 05 Nov 2022 10:07:59 -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=IFtyYRE/QfCJSzHWQ5G/2Hcs0YCzicj8Mpg0peBNurk=; b=M0fVL96fR586kojBwNsFRxSh/zFXsqvWG2Psxe8saWm0D9ZYK8sydiSStlWARez7Bh NEXYqeVTUxXw0eLavViNp0UtdoU6jiiGdN3vFhJx61eUQHWK1qtSS/0BxL15KjWLrqWE epn7mkfKYhNvrmSQpcw3pSC7Oei5MaIHe3dPd35GakpV1hvfLgSZs94RfgGcpGdb1EFE 4M4U2WAm2K/mLZrU87IJZ1LUkwCHvnnPL0ftNYdhbHId1+ytl7KFO7XrwK1oTt6lh2Sa BzNs5Zf4Q2B2P4bpCxGGjJ/eVKk0quTIVwwC87oYY0S9hwaE1tsSeQsGKVIYlOVdIFUm trCg== 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=IFtyYRE/QfCJSzHWQ5G/2Hcs0YCzicj8Mpg0peBNurk=; b=ClA1u448DTXoltZZidI8hmWpp++4u1ldVPVgkF7yvl7FQQ6ZQDFhH7T2PZoVgi/8hK xtTSBp48rOZxjmebjQXJsFBXDdjGRET6MdD0DiDZFg1Wdmhiyl7xd/x2dZTvVSFADxnL cIpdSnxZFIuMZp8kLAHx7X224YEUAGgs+0S7z+1qOcfQnR8jefHr/aBwUL0HB6CgKub/ LsNYf/tzXabu0skjTf8FWlOPHDvkRKWM4TdqS8MsFKgCyIeGZ23t0U4dX4bT/cMauFgp C5h9KC4b1j+B3NI/4ef3yXvWwsMI6p3jJgBsqEWcJ5hI6Jl/l/ool7Jt/eX0tprLITLK wWfw== X-Gm-Message-State: ACrzQf28maxJUD+XERZ+pKFRe+SFzcExJiX1RW7XG7/SyiJy8DrpUVob PKSUoIfLVSm5jCf/WH0hnAGJNlDX9XQ= X-Google-Smtp-Source: AMsMyM40psWJ3q9AIBDxuJUSjdFlFFVdYGbnhbRoU5x08Ec32If3zK+h1vUY6Omo8wlgyE+pF0jd2w== X-Received: by 2002:a17:90a:8a8c:b0:213:c06c:7003 with SMTP id x12-20020a17090a8a8c00b00213c06c7003mr39108862pjn.147.1667668078466; Sat, 05 Nov 2022 10:07:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:07:58 -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 01/13] bisect tests: test for v2.30.0 "bisect run" regressions Date: Sun, 6 Nov 2022 00:07:32 +0700 Message-Id: <5571bc36b84210e16ab8731fea8bf0ed8d62cca3.1667667460.git.congdanhqx@gmail.com> 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 Add three failing tests which succeed on v2.29.0, but due to the topic merged at [1] (specifically [2]) have been failing since then. We'll address those regressions in subsequent commits. There was also a "regression" where: git bisect run ./missing-script.sh Would count a non-existing script as "good", as the shell would exit with 127. That edge case is a bit too insane to preserve, so let's not add it to these regression tests. 1. 0a4cb1f1f2f (Merge branch 'mr/bisect-in-c-4', 2021-09-23) 2. d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13) Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- t/t6030-bisect-porcelain.sh | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 6dbbe62eb2..6901bbd202 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -252,6 +252,85 @@ test_expect_success 'bisect skip: with commit both bad and skipped' ' grep $HASH4 my_bisect_log.txt ' +test_bisect_run_args () { + test_when_finished "rm -f run.sh actual" && + >actual && + cat >expect.args && + cat <&6 >expect.out && + cat <&7 >expect.err && + write_script run.sh <<-\EOF && + while test $# != 0 + do + echo "<$1>" && + shift + done >actual.args + EOF + + test_when_finished "git bisect reset" && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH4 && + git bisect run ./run.sh $@ >actual.out.raw 2>actual.err && + # Prune just the log output + sed -n \ + -e '/^Author:/d' \ + -e '/^Date:/d' \ + -e '/^$/d' \ + -e '/^commit /d' \ + -e '/^ /d' \ + -e 'p' \ + actual.out && + test_cmp expect.out actual.out && + test_cmp expect.err actual.err && + test_cmp expect.args actual.args +} + +test_expect_failure 'git bisect run: args, stdout and stderr with no arguments' ' + test_bisect_run_args <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR + EOF_ARGS + running ./run.sh + $HASH4 is the first bad commit + bisect run success + EOF_OUT + EOF_ERR +' + +test_expect_failure 'git bisect run: args, stdout and stderr: "--" argument' ' + test_bisect_run_args -- <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR + <--> + EOF_ARGS + running ./run.sh -- + $HASH4 is the first bad commit + bisect run success + EOF_OUT + EOF_ERR +' + +test_expect_failure 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' ' + test_bisect_run_args --log foo --no-log bar <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR + <--log> + + <--no-log> + + EOF_ARGS + running ./run.sh --log foo --no-log bar + $HASH4 is the first bad commit + bisect run success + EOF_OUT + EOF_ERR +' + +test_expect_failure 'git bisect run: args, stdout and stderr: "--bisect-start" argument' ' + test_bisect_run_args --bisect-start <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR + <--bisect-start> + EOF_ARGS + running ./run.sh --bisect-start + $HASH4 is the first bad commit + bisect run success + EOF_OUT + EOF_ERR +' + # We want to automatically find the commit that # added "Another" into hello. test_expect_success '"git bisect run" simple case' ' 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; } From patchwork Sat Nov 5 17:07:34 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: 13033105 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 45AD1C43217 for ; Sat, 5 Nov 2022 17:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbiKERII (ORCPT ); Sat, 5 Nov 2022 13:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiKERIF (ORCPT ); Sat, 5 Nov 2022 13:08:05 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89159DFAB for ; Sat, 5 Nov 2022 10:08:04 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id b29so7055209pfp.13 for ; Sat, 05 Nov 2022 10:08:04 -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=bWKfCu3eizclDoAKKYbSK6+t0cQM0hGqk2Q2WU2E+ZE=; b=WDX5JjLal5smXXZBCvt3eynugIc4c6w7YUrWzzdOTxxeMDhMHpsDNKFSN+KeWDPmtJ vRyQSV6vgVL+QRDd6TypbcoN8DF8W0ChkqoRQ26GYe1WplJqABc8R5PrkXPAHwBnukY2 l4UUPz88fcEZ6w0uHbqaZdTFbyWTmdDQBFSxn2SwI0A6eAaDs6/ySgrX/yo9ODMleOy5 aMd9rbujNJXYUv2hATa4JN5SknGRhDqlAhBwK88Efrm7kFeg5VorTpVWYXpsxJpkUaj5 z7aGpyro37fOeUNjyjsMAMVwsJ/S/alX+dzTM+QFkuNBlW1S3CwxArV/L/XaV1Fi0LjO w1yg== 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=bWKfCu3eizclDoAKKYbSK6+t0cQM0hGqk2Q2WU2E+ZE=; b=AgGqwnieJ+HpVRcErJBCkXy5T7S3UzmPdQaUjkWcvUCy//LZbUAzcA+ElRpM3aKejO wMRMEXohMICWAqN/01iUhBHzpw86/Fu0gyzq7gKGBUUaozxADhLycxNX8V5tqGZeCSzx Bf6sThmjCTty4Accz3hTHecvbOum/RVjiwAkiccPHLvG6TO8Yx5yDDtArhDzx+tBkbi3 YkemYcgMT3MD6XLw6xujur9bwhSoQuR2zpS62A72ZzGdlwOjmfQM2+z9CxgtPu3Md+HL BnQvzvcqQLzN0EH6y3kezLG3/QqvlgVs2FSzohsfI/R1CpHYOzVVe8MLNJLvMv7VyYGf hOMg== X-Gm-Message-State: ACrzQf2bcYAUcjWeBLA8WP4c9bmtxPBrl0u5+lViGhfEOgvX3JqYZKss SLuVEql5FW7MHHWTBQkRKEcaL5rEZFo= X-Google-Smtp-Source: AMsMyM5s3a6Vsn3oVIGnhbg8xkBV2/ZCsEaOqE9fzyenmUCdRwjHViJsOx9zzPbaekbOaxDT0GWZyA== X-Received: by 2002:a05:6a00:852:b0:56d:e2bc:1978 with SMTP id q18-20020a056a00085200b0056de2bc1978mr22695766pfk.47.1667668083657; Sat, 05 Nov 2022 10:08:03 -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.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:03 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Subject: [PATCH 03/13] bisect--helper: pass arg[cv] down to do_bisect_run Date: Sun, 6 Nov 2022 00:07:34 +0700 Message-Id: <8a815e231100b8bfcf2b03355cf11a36b2962a38.1667667460.git.congdanhqx@gmail.com> 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 Commit d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13) has changed the logging of bisect-run by adding one more space before argv[0], and single-quoting all arguments. In a later change, we would like to restore the old behaviours, which would need information regarding argc and argv. Let's pass them down, now. Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ee1197c8b2..35e5dc4bbf 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1141,7 +1141,7 @@ static int get_first_good(const char *refname UNUSED, return 1; } -static int do_bisect_run(const char *command) +static int do_bisect_run(const char *command, int argc UNUSED, const char **argv UNUSED) { struct child_process cmd = CHILD_PROCESS_INIT; @@ -1151,7 +1151,7 @@ static int do_bisect_run(const char *command) return run_command(&cmd); } -static int verify_good(const struct bisect_terms *terms, const char *command) +static int verify_good(const struct bisect_terms *terms, const char *command, int argc, const char **argv) { int rc; enum bisect_error res; @@ -1171,7 +1171,7 @@ static int verify_good(const struct bisect_terms *terms, const char *command) if (res != BISECT_OK) return -1; - rc = do_bisect_run(command); + rc = do_bisect_run(command, argc, argv); res = bisect_checkout(¤t_rev, no_checkout); if (res != BISECT_OK) @@ -1198,7 +1198,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) sq_quote_argv(&command, argv); while (1) { - res = do_bisect_run(command.buf); + res = do_bisect_run(command.buf, argc, argv); /* * Exit code 126 and 127 can either come from the shell @@ -1208,7 +1208,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) * missing or non-executable script. */ if (is_first_run && (res == 126 || res == 127)) { - int rc = verify_good(terms, command.buf); + int rc = verify_good(terms, command.buf, argc, argv); is_first_run = 0; if (rc < 0) { error(_("unable to verify '%s' on good" From patchwork Sat Nov 5 17:07:35 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: 13033106 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 D0A98C433FE for ; Sat, 5 Nov 2022 17:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230077AbiKERIS (ORCPT ); Sat, 5 Nov 2022 13:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiKERII (ORCPT ); Sat, 5 Nov 2022 13:08:08 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BABEE08B for ; Sat, 5 Nov 2022 10:08:07 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id p12so2064342plq.4 for ; Sat, 05 Nov 2022 10:08:07 -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=zqtsFEImrv+PGMPFGChSgSAJ+j/5GMEgmedC7QxWQV0=; b=hrTtrEnHZR5nMYRqCUjrQOO9J0h3RdjeS9PT7+TzyoNrScZh+2NbqtjV8xtTc3Nn1a HHvXsWx/Wk04MTHPN71ggil9s788aPicBnv39bqg1XJbCxPJMn7FLyPvQBa+0KVlP0Sd W954HTHKdK1y7urFUqWjjgtvlDxSmrzaaQqWvy/z99dyLfEnz/uPlIYL7xeSHc50RQUs mspneCAuNIIJJiVg/zr6k/JrzqyspNABpfJM3Q0mq6msCgc9DLq/x9CF3bJdaSttYZpA AmcTGa471PcC38s2pQzhsNPz2A9UR6TsGLw9smrkYvJ3Jqp4OndJOm/XpLi7kJmrwjye dsYg== 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=zqtsFEImrv+PGMPFGChSgSAJ+j/5GMEgmedC7QxWQV0=; b=eYCSz1zA14l/65ti9ygo1+Dmtbi2TlxWXBp80mvIv4McOsnAUP95nVwi5KnlimPsyc BR1c7Pqu2w7ARjQaZtbG2HaEl0m8cWb+F3+HIpAq7UyLoGOVCjNpk5qfRn7XScA8nr8Y lVWrMd5HfkgHgCt6bzZKs69xCiUXj2OaRVbw7NGNJ3OzzjTg2BC+ir3r8k8afeIkb9i9 beVQ5wIf9RHvLck3wewPUhvkGhyQMypcazQR4qr+wfjRt+Ectw/tIDgVLVu47QTrVe41 ppTorOL7zxTnD7IW79XM/jmnmJz0E1fppb2FGHmP/saGcVXDI4RLUeungtkW7L8/0/JU hUDg== X-Gm-Message-State: ACrzQf2pGi7c706CXJV3LMz1F4K1QJZocKt0Vtkml6zBDWtaROUIKEy5 2fHFqQamJIYQK0ObUjCIsVU9wrh4COo= X-Google-Smtp-Source: AMsMyM5TMyiuwk17cbt97HRp05xS70LI/QN/hJLfh32mxb5jUYwu05RjJo4iChvlgufFeiGSkJBV4Q== X-Received: by 2002:a17:90b:50e:b0:213:d7cb:83e3 with SMTP id r14-20020a17090b050e00b00213d7cb83e3mr35156407pjz.232.1667668086236; Sat, 05 Nov 2022 10:08:06 -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.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:05 -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 04/13] bisect: fix output regressions in v2.30.0 Date: Sun, 6 Nov 2022 00:07:35 +0700 Message-Id: <31cd78f53878b09ae74e40994070fbc8c25102f7.1667667460.git.congdanhqx@gmail.com> 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 When d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13) reimplemented parts of "git bisect run" in C it changed the output we emitted so that: - The "running ..." line was now quoted - We lost the \n after our output - We started saying "bisect found ..." instead of "bisect run success" Arguably some of this is better now, but as d1bbbe45df8 did not advocate for changing the output, let's revert this for now. It'll be easy to change it back if that's what we'd prefer. This does not change the one remaining use of "command.buf" to emit the quoted argument, as that's new in d1bbbe45df8. Some of these cases were not tested for in the tests added in the preceding commit, I didn't have time to fleshen those out, but a look at f1de981e8b6 will show that the other output being adjusted here is now equivalent to what it was before d1bbbe45df8. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 13 ++++++++----- t/t6030-bisect-porcelain.sh | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 35e5dc4bbf..7416283d07 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1141,11 +1141,14 @@ static int get_first_good(const char *refname UNUSED, return 1; } -static int do_bisect_run(const char *command, int argc UNUSED, const char **argv UNUSED) +static int do_bisect_run(const char *command, int argc, const char **argv) { struct child_process cmd = CHILD_PROCESS_INIT; + struct strbuf buf = STRBUF_INIT; - printf(_("running %s\n"), command); + strbuf_join_argv(&buf, argc, argv, ' '); + printf(_("running %s\n"), buf.buf); + strbuf_release(&buf); cmd.use_shell = 1; strvec_push(&cmd.args, command); return run_command(&cmd); @@ -1260,13 +1263,13 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) if (res == BISECT_ONLY_SKIPPED_LEFT) error(_("bisect run cannot continue any more")); else if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) { - printf(_("bisect run success")); + puts(_("bisect run success")); res = BISECT_OK; } else if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) { - printf(_("bisect found first bad commit")); + puts(_("bisect run success")); res = BISECT_OK; } else if (res) { - error(_("bisect run failed: 'git bisect--helper --bisect-state" + error(_("bisect run failed: 'bisect-state" " %s' exited with error code %d"), new_state, res); } else { continue; diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 6901bbd202..914ea564b9 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -285,7 +285,7 @@ test_bisect_run_args () { test_cmp expect.args actual.args } -test_expect_failure 'git bisect run: args, stdout and stderr with no arguments' ' +test_expect_success 'git bisect run: args, stdout and stderr with no arguments' ' test_bisect_run_args <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR EOF_ARGS running ./run.sh @@ -295,7 +295,7 @@ test_expect_failure 'git bisect run: args, stdout and stderr with no arguments' EOF_ERR ' -test_expect_failure 'git bisect run: args, stdout and stderr: "--" argument' ' +test_expect_success 'git bisect run: args, stdout and stderr: "--" argument' ' test_bisect_run_args -- <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR <--> EOF_ARGS @@ -306,7 +306,7 @@ test_expect_failure 'git bisect run: args, stdout and stderr: "--" argument' ' EOF_ERR ' -test_expect_failure 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' ' +test_expect_success 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' ' test_bisect_run_args --log foo --no-log bar <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR <--log> @@ -320,7 +320,7 @@ test_expect_failure 'git bisect run: args, stdout and stderr: "--log foo --no-lo EOF_ERR ' -test_expect_failure 'git bisect run: args, stdout and stderr: "--bisect-start" argument' ' +test_expect_success 'git bisect run: args, stdout and stderr: "--bisect-start" argument' ' test_bisect_run_args --bisect-start <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR <--bisect-start> EOF_ARGS From patchwork Sat Nov 5 17:07:36 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: 13033107 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 4C01FC433FE for ; Sat, 5 Nov 2022 17:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbiKERIU (ORCPT ); Sat, 5 Nov 2022 13:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKERIR (ORCPT ); Sat, 5 Nov 2022 13:08:17 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE82E0B1 for ; Sat, 5 Nov 2022 10:08:09 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id l2so7528823pld.13 for ; Sat, 05 Nov 2022 10:08:09 -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=5QCCLi420XamhPYi2nK2ZtveTOFCgi6Gy6dRkWmkvDI=; b=p9lh27vFOl+LtiIECQ3hS5L5KpkcKs80PF6NOq+p7uBRHvm6PF8OL8+q/9wwtFpfHJ kY0LwzOykH2HRxxN280LsWkcTfuGK/XjdbrTeeMWCZV0fzV+s2Ekui03kKX8SftH+dgv m15+fixBvJU9o3wWVkoulPzSVEHkQElKjlgr2b/8egRArJisbQoTmXxMAYKCIxg0764O 8+LBQb4QuGRWz/0Y5HKDcmN+gpl2uL08eYDfE+LFEoeWdrxJiwOLx6r9vLfcGpbnY2Xy 3j8cn0pj0LHIz3tjYF8nTVPZU3LFrHbrxWaauKThNZ/vxoh+8JpZXtbTmfQ2KZvnwNNa fOmA== 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=5QCCLi420XamhPYi2nK2ZtveTOFCgi6Gy6dRkWmkvDI=; b=k40izDknFFBN/YbUVzve/hceSujpCZ51nOJ1nWt4UAhWNh7w7jKp5yPR1XYGnGRPLT IFDhsQPLUQVhKhHH7ANOOfl9IaE0KE00XracDV09SscWrEMgJ/mnnlsnSf4FJKjvxm6E goaKKaDIhf704O1nnKKkwt+x7sgr/1oxfdq6fJAUG00YHLAdx8BVcd1/ba+hFzIH4L7u BL+0VKT71ft5ThwqVHWvkIG9L07dWxwh6+BG56cVvLSjGtzrqx7sWoMWubYhM50z14bf BkJMdz+hdGPdgRP8rMWZSmboiAkgnQ20GPNCHK9ttX7s9OnU41WF+rIuA2Bp/Ib1ktKw XWFQ== X-Gm-Message-State: ACrzQf3Xn+G3UArm9gkXengBGIOzm5009vEfRITNT4BRW+gX9iP12+y3 Dg/pkOj5vS05Um9pLZcUohF2g0Ns3gQ= X-Google-Smtp-Source: AMsMyM5+jW9W19ixZaJUvogm8GoFP/MJ8SlGEi1EGL4AF1vQUX+krymM+k2lhs1eqcDCHgG6Dibb7g== X-Received: by 2002:a17:902:ea95:b0:186:a6b7:4410 with SMTP id x21-20020a170902ea9500b00186a6b74410mr42724210plb.109.1667668088865; Sat, 05 Nov 2022 10:08:08 -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.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:08 -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 05/13] bisect run: keep some of the post-v2.30.0 output Date: Sun, 6 Nov 2022 00:07:36 +0700 Message-Id: <5ba3bafdd48b47320624d0db06f379bc0a4b8d4e.1667667460.git.congdanhqx@gmail.com> 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 Preceding commits fixed output and behavior regressions in d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), which did not claim to be changing the output of "git bisect run". But some of the output it emitted was subjectively better, so once we've asserted that we're back on v2.29.0 behavior, let's change some of it back: - We now quote the arguments again, but omit the first " " when printing the "running" line. - Ditto for other cases where we emitted the argument - We say "found first bad commit" again, not just "run success" Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 12 ++++++------ t/t6030-bisect-porcelain.sh | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 7416283d07..f16b9df8fd 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1141,14 +1141,14 @@ static int get_first_good(const char *refname UNUSED, return 1; } -static int do_bisect_run(const char *command, int argc, const char **argv) +static int do_bisect_run(const char *command, int argc UNUSED, const char **argv UNUSED) { struct child_process cmd = CHILD_PROCESS_INIT; - struct strbuf buf = STRBUF_INIT; + const char *trimed = command; - strbuf_join_argv(&buf, argc, argv, ' '); - printf(_("running %s\n"), buf.buf); - strbuf_release(&buf); + while (*trimed && isspace(*trimed)) + trimed++; + printf(_("running %s\n"), trimed); cmd.use_shell = 1; strvec_push(&cmd.args, command); return run_command(&cmd); @@ -1266,7 +1266,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) puts(_("bisect run success")); res = BISECT_OK; } else if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) { - puts(_("bisect run success")); + puts(_("bisect found first bad commit")); res = BISECT_OK; } else if (res) { error(_("bisect run failed: 'bisect-state" diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 914ea564b9..9e14e1e836 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -288,9 +288,9 @@ test_bisect_run_args () { test_expect_success 'git bisect run: args, stdout and stderr with no arguments' ' test_bisect_run_args <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR EOF_ARGS - running ./run.sh + running '\''./run.sh'\'' $HASH4 is the first bad commit - bisect run success + bisect found first bad commit EOF_OUT EOF_ERR ' @@ -299,9 +299,9 @@ test_expect_success 'git bisect run: args, stdout and stderr: "--" argument' ' test_bisect_run_args -- <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR <--> EOF_ARGS - running ./run.sh -- + running '\''./run.sh'\'' '\''--'\'' $HASH4 is the first bad commit - bisect run success + bisect found first bad commit EOF_OUT EOF_ERR ' @@ -313,9 +313,9 @@ test_expect_success 'git bisect run: args, stdout and stderr: "--log foo --no-lo <--no-log> EOF_ARGS - running ./run.sh --log foo --no-log bar + running '\''./run.sh'\'' '\''--log'\'' '\''foo'\'' '\''--no-log'\'' '\''bar'\'' $HASH4 is the first bad commit - bisect run success + bisect found first bad commit EOF_OUT EOF_ERR ' @@ -324,9 +324,9 @@ test_expect_success 'git bisect run: args, stdout and stderr: "--bisect-start" a test_bisect_run_args --bisect-start <<-\EOF_ARGS 6<<-EOF_OUT 7<<-\EOF_ERR <--bisect-start> EOF_ARGS - running ./run.sh --bisect-start + running '\''./run.sh'\'' '\''--bisect-start'\'' $HASH4 is the first bad commit - bisect run success + bisect found first bad commit EOF_OUT EOF_ERR ' From patchwork Sat Nov 5 17:07:37 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: 13033108 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 AFC9CC4332F for ; Sat, 5 Nov 2022 17:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbiKERIX (ORCPT ); Sat, 5 Nov 2022 13:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiKERIR (ORCPT ); Sat, 5 Nov 2022 13:08:17 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5150610B76 for ; Sat, 5 Nov 2022 10:08:12 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so7002196pjk.1 for ; Sat, 05 Nov 2022 10:08:12 -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=DwwhjvUZbGwC1Q7VY+wqYjMrtxoFGAbUAgTR1EqcyEk=; b=fkHNfUMt5UMGJ58/oNy0FsOS/R59slJFNrHaA/NY8vaAJ+IxSn2MU7SzqrC2Z0++vw 8kinDbFSniNVqty1OU7c8ZesrbZ7wS7ZuShMG6vEXTSxb9otZQpIZja8pM4Ws5TVICi8 Ygs3kY0PRXmuG1FtWhVeGzIIJS1ZQGbGU1zESVXJPEXoiP9WB4oomBMMrgxgiUjuJPkh FMmkFVrep0itLPvT6iBOKdJIanXF7PZlSZjcB0igkph55Uf6TaqLb+pBI2+lkWunu1qZ SLYjmFy5sGhYyQ6g6S3yFubsLuJayGP8/TK9626RcDPF1wI8c01EQCV8Fx0sOMpzZOPP Hd9A== 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=DwwhjvUZbGwC1Q7VY+wqYjMrtxoFGAbUAgTR1EqcyEk=; b=l/fhFXDWQUPdXuwyTSyQ742+qbCH9KRyW8Ii4+Yse6D6yWVLuMJa2nal3adeHy2D6V otJW7TVM/j2dnYIw0m6Bpl326R5RkO3ks7mGLZlFm0j2ouRVU0ukj5CRc0KPtK+odfPB pn5jH3zXa0hytp+79Ktjqez/WtAoZDPHw2Tqb41mspoGzkAiI3QdeGuggk+DRi//n6Dr BpNKjylEezBtXBBShf4m0aGirbD3IjQepOVKuRVJzRoS/afwUGWgzbGSBaPYwCcME68E xFinhhpoK7Nn8o0PKWwY7UTI3CXgEjMAK7GHMpolCNw29csaoF+rViuKLWuMeJeQUkFa 8MHQ== X-Gm-Message-State: ACrzQf3VZ7UIFMdwWGMiEjGewNQVLX7pqd12a+bWLJPNs7yYnmMcA7Xf ax9ak0XJOWxckw9THBXw2FrhkJP8jf0= X-Google-Smtp-Source: AMsMyM5FaiJ3HgRiFJ9hmAgGCjxbJ21ZNNKQBDVz+62Nv2k7kyIomZ5PQksDSKfvrMwqtdcBULUiyw== X-Received: by 2002:a17:90b:3a88:b0:213:f069:7197 with SMTP id om8-20020a17090b3a8800b00213f0697197mr30650629pjb.181.1667668091465; Sat, 05 Nov 2022 10:08:11 -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.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:11 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Subject: [PATCH 06/13] bisect--helper: remove unused arguments from do_bisect_run Date: Sun, 6 Nov 2022 00:07:37 +0700 Message-Id: <32ad47ddc521320dd67947b20fe548184d1a6b36.1667667460.git.congdanhqx@gmail.com> 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 Those arguments become unused with previous commit, let's remove them now. This effectively reverts commit HEAD~3. Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index f16b9df8fd..b99cbb0dbe 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1141,7 +1141,7 @@ static int get_first_good(const char *refname UNUSED, return 1; } -static int do_bisect_run(const char *command, int argc UNUSED, const char **argv UNUSED) +static int do_bisect_run(const char *command) { struct child_process cmd = CHILD_PROCESS_INIT; const char *trimed = command; @@ -1154,7 +1154,7 @@ static int do_bisect_run(const char *command, int argc UNUSED, const char **argv return run_command(&cmd); } -static int verify_good(const struct bisect_terms *terms, const char *command, int argc, const char **argv) +static int verify_good(const struct bisect_terms *terms, const char *command) { int rc; enum bisect_error res; @@ -1174,7 +1174,7 @@ static int verify_good(const struct bisect_terms *terms, const char *command, in if (res != BISECT_OK) return -1; - rc = do_bisect_run(command, argc, argv); + rc = do_bisect_run(command); res = bisect_checkout(¤t_rev, no_checkout); if (res != BISECT_OK) @@ -1201,7 +1201,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) sq_quote_argv(&command, argv); while (1) { - res = do_bisect_run(command.buf, argc, argv); + res = do_bisect_run(command.buf); /* * Exit code 126 and 127 can either come from the shell @@ -1211,7 +1211,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) * missing or non-executable script. */ if (is_first_run && (res == 126 || res == 127)) { - int rc = verify_good(terms, command.buf, argc, argv); + int rc = verify_good(terms, command.buf); is_first_run = 0; if (rc < 0) { error(_("unable to verify '%s' on good" From patchwork Sat Nov 5 17:07:38 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: 13033109 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 DFF01C433FE for ; Sat, 5 Nov 2022 17:08:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbiKERIe (ORCPT ); Sat, 5 Nov 2022 13:08:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbiKERIS (ORCPT ); Sat, 5 Nov 2022 13:08:18 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF4011A03 for ; Sat, 5 Nov 2022 10:08:14 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id l2so7528921pld.13 for ; Sat, 05 Nov 2022 10:08:14 -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=xGnVbKSr6sG1SWtivZ1DAE1XsqS62Dit1sTSItgzhd0=; b=HNAhuJxMozihvGbQF9TkuGTAEe7IWs7C9GK7Weqp8CeMFXc4KtJsTaiJ2ewsz2IIHb ICSEaI0bILYMfISyvWGOigt5t1Nthb1BldkxbuIyId4D3JmHCYOZkzIO0AVMSfdDDTEd GiPaECs4c0gz6N65C+n2Blarksn7LVOSL+Ty5dmZymDj239fBLIuiCpDmjULAMjj0JaA qRP+hwJ4y5MuS7Rsmz59HXA2dfu8xWk7mK9oLf+msDUJ8EQC+J2sgJ1z1X1ryPUF4hRc Z3WZeScf8YMqH37ogWawiJ7DlQHtlr8GO0YBtycriYS5JVFCZu2bvdvw2ZW8j4caBN+8 srgw== 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=xGnVbKSr6sG1SWtivZ1DAE1XsqS62Dit1sTSItgzhd0=; b=Y94HinNbNOw+ONmXO+Mhlqaky+IMbs2dLp2cBQrQJOfrP5zvVaoe4fRFHoR5vr3ncM rEolY+pZH88SsdedLMowfCxWulojNQwoJXHywrtN+POLzWfLHieKsjHlJmT+8YOrMl8a 8Rcsi/yUE8vYX3lCZ+lQu4z0OxcYun6p+LRizUS6dizwBZkzRfsV8GklB9oE0CkuZgpy h2XknC+tc4OAbk4GxsmBscRh/kHVO9CJ57GGw8xJ6+g6FrrTa55cmQ8UYlUmYGNT1rVb xX5vmLgT6Dy7LI375rlwmctrHYy/nGsKTqIdr25fZd1DgwaBnXSYyNoyeZly/+w7jAgu FF1A== X-Gm-Message-State: ACrzQf1c6tEKT1ZXAqvL0szpIhUlvrprt1BGfQs8z6QBI9jh/W52eEuJ zmk+B84j1Yo/+etaHdE0l72AkV8UQns= X-Google-Smtp-Source: AMsMyM7pbMy2N1v/FhXOYZq/80eWyGld7/ytLJOsN0yvEztepVmE1n6uy2LrxZ2R0dUxDEMydk4gvQ== X-Received: by 2002:a17:90b:1950:b0:212:de19:b3ce with SMTP id nk16-20020a17090b195000b00212de19b3cemr41595613pjb.16.1667668094085; Sat, 05 Nov 2022 10:08:14 -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.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:13 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Subject: [PATCH 07/13] bisect--helper: pretend we're real bisect when report error Date: Sun, 6 Nov 2022 00:07:38 +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 In a later change, we will convert the bisect--helper to be builtin bisect. Let's start by pretending it's the real bisect when reporting error. Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index b99cbb0dbe..6be4d8861e 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1284,7 +1284,8 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED) { if (argc > 1) - return error(_("--bisect-reset requires either no argument or a commit")); + return error(_("'%s' requires either no argument or a commit"), + "git bisect reset"); return bisect_reset(argc ? argv[0] : NULL); } @@ -1294,7 +1295,8 @@ static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNU struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; if (argc > 1) - return error(_("--bisect-terms requires 0 or 1 argument")); + return error(_("'%s' requires 0 or 1 argument"), + "git bisect terms"); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); free_terms(&terms); return res; @@ -1317,7 +1319,8 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; if (argc) - return error(_("--bisect-next requires 0 arguments")); + return error(_("'%s' requires 0 arguments"), + "git bisect next"); get_terms(&terms); res = bisect_next(&terms, prefix); free_terms(&terms); @@ -1339,7 +1342,7 @@ static int cmd_bisect__state(int argc, const char **argv, const char *prefix UNU static int cmd_bisect__log(int argc, const char **argv UNUSED, const char *prefix UNUSED) { if (argc) - return error(_("--bisect-log requires 0 arguments")); + return error(_("'%s' requires 0 arguments"), "git bisect log"); return bisect_log(); } @@ -1385,7 +1388,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; if (!argc) - return error(_("bisect run failed: no command provided.")); + return error(_("'%s' failed: no command provided."), "git bisect run"); get_terms(&terms); res = bisect_run(&terms, argv, argc); free_terms(&terms); From patchwork Sat Nov 5 17:07:39 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: 13033110 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 DF1FCC4332F for ; Sat, 5 Nov 2022 17:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbiKERIi (ORCPT ); Sat, 5 Nov 2022 13:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiKERIT (ORCPT ); Sat, 5 Nov 2022 13:08:19 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40575DFF8 for ; Sat, 5 Nov 2022 10:08:17 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so6979901pjd.4 for ; Sat, 05 Nov 2022 10:08:17 -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=A2qu9jcjV9kYpZCVJHVc9+1r5Adeb/nE6EFzmYw+6Xo=; b=P9Efpie/zHpma2X4uxcFUraWrOxAiLe6NwMruupuQDRF+7a+5dmzWDm+ZkipExJMz2 1rqTg+rnyrq+2NbvqaQlS1Ri5+tv2SmPlLk1fP8vwkDxCgzC9cRPe2V5hsA6RTaiGARy HqxZJY94H1zTWgd6X8COl10+TuDd2+nN8wpOCNBz0BkR6Y0aQNsF7X5T4lEBFsSicGGk qd4eUMPMok3UPZoH5qsOyKAEhyU6EajTNCjSzd9phV6FdrANAm4fU4LMEllW+RGoDmFy USYQ3/OPQGaXaGf2You4DHYDbHG5JRgdNYIS3nWQ39kyl30bR/APAHRV4Pq7na4oL6lV g9og== 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=A2qu9jcjV9kYpZCVJHVc9+1r5Adeb/nE6EFzmYw+6Xo=; b=VLKy4GCTv/z/G81V2+FaTcbYeA/jrnYLNhHXFl6ls8t3DVcNKi5PEJA2C4qwWwiRy5 QmUooLavTWWiY1x/gUJPBzmZfU8y3h4Ixt4Xqa3+rWWm7pRxzKv+DFtSBxez35OMOXq6 noZ7POwy8Qic3sX0eRBVASVMdr+YUO5FF76igCVd/nvAi7H92c+vEDOdRvk2LtBldl+Y nW7SWFLHmoq94NL0tuwMF/WFD4xnR8SaHNheIbHvlMqyYy5YMuwFq+x5eDrVbDglAizc 0st+VmyEiXXN3XEHpfQxZ4qu6TrIRqXKBIVRMY9Z3oCPt9fCQzTaltQnyU+djch/SxaU ZGtQ== X-Gm-Message-State: ACrzQf2TriuUf5/b9r4pjkNVcYJCUfeMjra5w8U/Apmw7WfORwciZGDu bWaU20ZGnhGtyezsWXtcc/fCTvpgX1U= X-Google-Smtp-Source: AMsMyM5SKKOsmUUOHn985GXc31yS/dP06QNsI50Nqc2YycoZ4Q9evymNh/PxJ3IxA/rd+7I32ELjiQ== X-Received: by 2002:a17:902:ec81:b0:187:1dbd:b85b with SMTP id x1-20020a170902ec8100b001871dbdb85bmr33281680plg.78.1667668096661; Sat, 05 Nov 2022 10:08:16 -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.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:16 -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 08/13] bisect test: test exit codes on bad usage Date: Sun, 6 Nov 2022 00:07:39 +0700 Message-Id: <4c1beb8bf8e4237c3c03fc3298bb3e5979740e1b.1667667460.git.congdanhqx@gmail.com> 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 Address a test blindspot, the "log" command is the odd one out because "git-bisect.sh" ignores any arguments it receives. Let's test both the exit codes we expect, and the stderr and stdout we're emitting. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- t/t6030-bisect-porcelain.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 9e14e1e836..01eaa368d9 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -34,6 +34,36 @@ HASH2= HASH3= HASH4= +test_bisect_usage () { + local code="$1" && + shift && + cat >expect && + test_expect_code $code "$@" >out 2>actual && + test_must_be_empty out && + test_cmp expect actual +} + +test_expect_success 'bisect usage' " + test_bisect_usage 1 git bisect reset extra1 extra2 <<-\EOF && + error: 'git bisect reset' requires either no argument or a commit + EOF + test_bisect_usage 1 git bisect terms extra1 extra2 <<-\EOF && + error: 'git bisect terms' requires 0 or 1 argument + EOF + test_bisect_usage 1 git bisect next extra1 <<-\EOF && + error: 'git bisect next' requires 0 arguments + EOF + test_bisect_usage 1 git bisect log extra1 <<-\EOF && + error: We are not bisecting. + EOF + test_bisect_usage 1 git bisect replay <<-\EOF && + error: no logfile given + EOF + test_bisect_usage 1 git bisect run <<-\EOF + error: 'git bisect run' failed: no command provided. + EOF +" + test_expect_success 'set up basic repo with 1 file (hello) and 4 commits' ' add_line_into_file "1: Hello World" hello && HASH1=$(git rev-parse --verify HEAD) && From patchwork Sat Nov 5 17:07:40 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: 13033111 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 0832FC433FE for ; Sat, 5 Nov 2022 17:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbiKERIl (ORCPT ); Sat, 5 Nov 2022 13:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbiKERIW (ORCPT ); Sat, 5 Nov 2022 13:08:22 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C76E0E7 for ; Sat, 5 Nov 2022 10:08:20 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id d13-20020a17090a3b0d00b00213519dfe4aso7001785pjc.2 for ; Sat, 05 Nov 2022 10:08:20 -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=ZLtn2UgEFhBjn81VD+LMZdx9s2ftrF+8mDbiPHHDVak=; b=mKKQx/rz1tJwgoqcIAFbLc/z0ZEYfdKi8nmUgNo/rukLtV3bcga0kVoh3zqFTZZvnO 9NWwqptyVad3ewI5i60q4fLfzywfH2Gto8yoVKxVeqI9h2s798OjVjsMg7qNEygaWG2g b99ug0JbcrlyWLA2hX+1XE9eWDl111lfDt/HyBu0SJ6D3dsdhDjnGV5weV1DT3CExv7v 6I1dzdy8i+fnD8YoGqvMQIvh4eaERgnUIoS23wjqAEt2dG2OgtwyE4drMZK07YJQJKZE h0oyOUZZcMTem9FgYm33ymSFYvgSx0HMjy6fATvYdkTWj+DAJW9H6JKgm+iSukAViFQG v5LQ== 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=ZLtn2UgEFhBjn81VD+LMZdx9s2ftrF+8mDbiPHHDVak=; b=S/A4kF15brFbVfZA45Pu7K4YwmNGsKR9LzoFu/0DMBO+6wTBEjj6NdfU6M9Xv+gK5H z2t0Mu0pWI3LCEn3nMV3w94PpkxpOb1v3L8CrpFLk+kFTpvS21p5+8opW9G1OndOkb8p Nl+5Z0nfTwybbMtToK8f8lCGPwrb1SXSZpzKEJTaRfR4gvus+Knyah3Myd+f4cW5MN+z LtaBFHBPZIbXmqWfKBuWQzPrG6xrCEnCRaEQvgumYl/MwAKq0nIsAsuTv3TRX2JySH91 hf2j2YRwXv/5/fSaZ+LCnuM1ZJ8zXy9ptFdXFi1M9hE1eok3NUaa+Yc1KZBvloitzilZ bNdQ== X-Gm-Message-State: ANoB5plo+G3dG36rtw1dDHwPjFmK4n35mW8gz3GzgwilqUicbYNBoy/R C5xbM00nkNyC38WFCvteknhEMhX5sH0= X-Google-Smtp-Source: AA0mqf5JZfaC3ENgcgUuINWm4ilCLxmydoZDIh3uKnJ+opLG8SZVo++AAKVbFzZLqZ416s4rF094cw== X-Received: by 2002:a17:902:f652:b0:188:71b0:de66 with SMTP id m18-20020a170902f65200b0018871b0de66mr4198734plg.65.1667668099237; Sat, 05 Nov 2022 10:08:19 -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.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:18 -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 09/13] bisect--helper: emit usage for "git bisect" Date: Sun, 6 Nov 2022 00:07:40 +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 In subsequent commits we'll be removing "git-bisect.sh" in favor of promoting "bisect--helper" to a "bisect" built-in. In doing that we'll first need to have it support "git bisect--helper " rather than "git bisect--helper --", and then finally have its "-h" output claim to be "bisect" rather than "bisect--helper". Instead of suffering that churn let's start claiming to be "git bisect" now. In just a few commits this will be true, and in the meantime emitting the "wrong" usage information from the helper is a small price to pay to avoid the churn. Let's also declare "BUILTIN_*" macros, when we eventually migrate the sub-commands themselves to parse_options() we'll be able to re-use the strings. See 0afd556b2e1 (worktree: define subcommand -h in terms of command -h, 2022-10-13) for a recent example. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 51 ++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 6be4d8861e..bfa160dbf2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,18 +20,40 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN") -static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --bisect-reset []"), - "git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]", - N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" - " [--no-checkout] [--first-parent] [ [...]] [--] [...]"), - "git bisect--helper --bisect-next", - N_("git bisect--helper --bisect-state (bad|new) []"), - N_("git bisect--helper --bisect-state (good|old) [...]"), - N_("git bisect--helper --bisect-replay "), - N_("git bisect--helper --bisect-skip [(|)...]"), - "git bisect--helper --bisect-visualize", - N_("git bisect--helper --bisect-run ..."), +#define BUILTIN_GIT_BISECT_START_USAGE \ + N_("git bisect start [--term-{new,bad}= --term-{old,good}=]" \ + " [--no-checkout] [--first-parent] [ [...]] [--]" \ + " [...]") +#define BUILTIN_GIT_BISECT_STATE_USAGE \ + N_("git bisect (good|bad) [...]") +#define BUILTIN_GIT_BISECT_TERMS_USAGE \ + "git bisect terms [--term-good | --term-bad]" +#define BUILTIN_GIT_BISECT_SKIP_USAGE \ + N_("git bisect skip [(|)...]") +#define BUILTIN_GIT_BISECT_NEXT_USAGE \ + "git bisect next" +#define BUILTIN_GIT_BISECT_RESET_USAGE \ + N_("git bisect reset []") +#define BUILTIN_GIT_BISECT_VISUALIZE_USAGE \ + "git bisect visualize" +#define BUILTIN_GIT_BISECT_REPLAY_USAGE \ + N_("git bisect replay ") +#define BUILTIN_GIT_BISECT_LOG_USAGE \ + "git bisect log" +#define BUILTIN_GIT_BISECT_RUN_USAGE \ + N_("git bisect run ...") + +static const char * const git_bisect_usage[] = { + BUILTIN_GIT_BISECT_START_USAGE, + BUILTIN_GIT_BISECT_STATE_USAGE, + BUILTIN_GIT_BISECT_TERMS_USAGE, + BUILTIN_GIT_BISECT_SKIP_USAGE, + BUILTIN_GIT_BISECT_NEXT_USAGE, + BUILTIN_GIT_BISECT_RESET_USAGE, + BUILTIN_GIT_BISECT_VISUALIZE_USAGE, + BUILTIN_GIT_BISECT_REPLAY_USAGE, + BUILTIN_GIT_BISECT_LOG_USAGE, + BUILTIN_GIT_BISECT_RUN_USAGE, NULL }; @@ -1413,11 +1435,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_SUBCOMMAND("run", &fn, cmd_bisect__run), OPT_END() }; - argc = parse_options(argc, argv, prefix, options, - git_bisect_helper_usage, 0); + argc = parse_options(argc, argv, prefix, options, git_bisect_usage, 0); if (!fn) - usage_with_options(git_bisect_helper_usage, options); + usage_with_options(git_bisect_usage, options); argc--; argv++; From patchwork Sat Nov 5 17:07:41 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: 13033112 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 C757DC4332F for ; Sat, 5 Nov 2022 17:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbiKERIu (ORCPT ); Sat, 5 Nov 2022 13:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiKERIX (ORCPT ); Sat, 5 Nov 2022 13:08:23 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE54FC9 for ; Sat, 5 Nov 2022 10:08:22 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id y4so7568868plb.2 for ; Sat, 05 Nov 2022 10:08:22 -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=9VQpaKMcn6bHAChQ9L+fuITIsR8U2S9eznDl7WQGlMI=; b=CkhRsEwRPAq0I478mmgq6QsJSPSWRfVGh2Ofuo0rh0VGLTEueVWbAR246bA5s4Ylru KrSSJPnvpZ/+vaxUdGpJNGnB+dOYSqoKK04PWzBdn7XRpDgj7V/GEQ/tabxvA4Ngmxd5 uufmA07gDtMGCg2iVmNYHXYC+xUydXnd3l9XvZCAAOMZxzcDxcMgmJw17U2QUCCTJ9nf 02Wpxj3MuxpW9kLjUS5YPKLxt2P+jmlTUjcFEtmhwbHA6m3JIp+JMkFIUpOumO0zxO4N 2c6Ao747VuW0jNwLu/M8Ny/TR1QYcvelUY5Yl3P+44a80/ae+GY1hgOYdcuSubb8UwI2 qOqg== 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=9VQpaKMcn6bHAChQ9L+fuITIsR8U2S9eznDl7WQGlMI=; b=NyNN2zfzl/rERpeNr27g7EfF+xDsNFqoAy4SRAypVHW/WAyu5TYG9VpJ0Vxeflrhip RAsUJ7SP4U4xyTnMXFItKsFjjlAln6O3U7YgMoIDZOvs2GVIJQxUf3k3Ha3Fp36dY0LJ cwJ8nE9KbesdHSyQ3eze7yRrcl9HF8SYA570ripIgwhrOlesP61zVWIUcY+thec9yMNp JwkRbJC6yT1J53C9Z0dFymzgwcJZhjjHPjnphg+6dqC0odG6uGh3Uz+7UY3hStcYi0h5 HGXhZrauFh9LOxCqkUtz0TzvfVQwAdDOWlXxAJAFoDkoBSq/h4a6i4l6wymoudqxTt0P +Q4A== X-Gm-Message-State: ACrzQf1xTmaFm/XjS89h3UaoVLV5m9EF9xNMQxhmtQD+CCtsO1gvMx2h vOVJK0JFIHrBW1z8Zw9S1a0Bkzr3u/U= X-Google-Smtp-Source: AMsMyM7PaJbxbzRlGGwxuz0G+kkExRzXKkjvTrirRxNMlLWq4hTqyKoVniU4NUP6B+K9IQi/PxSwKQ== X-Received: by 2002:a17:90b:2651:b0:20a:daaf:75f0 with SMTP id pa17-20020a17090b265100b0020adaaf75f0mr41110360pjb.142.1667668102062; Sat, 05 Nov 2022 10:08:22 -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.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:21 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: Johannes Schindelin , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= , =?utf-8?b?xJBvw6BuIFRy?= =?utf-8?b?4bqnbiBDw7RuZyBEYW5o?= Subject: [PATCH 10/13] bisect--helper: make `state` optional Date: Sun, 6 Nov 2022 00:07:41 +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: Johannes Schindelin In preparation for making `git bisect` a real built-in, let's prepare the `bisect--helper` built-in to handle `git bisect--helper good` and `git bisect--helper bad`, i.e. do not require the `state` subcommand to be passed explicitly. Signed-off-by: Johannes Schindelin Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 29 +++++++++++++++++++++-------- git-bisect.sh | 2 -- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index bfa160dbf2..3c7a16355a 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1435,14 +1435,27 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_SUBCOMMAND("run", &fn, cmd_bisect__run), OPT_END() }; - argc = parse_options(argc, argv, prefix, options, git_bisect_usage, 0); - - if (!fn) - usage_with_options(git_bisect_usage, options); - argc--; - argv++; - - res = fn(argc, argv, prefix); + argc = parse_options(argc, argv, prefix, options, git_bisect_usage, + PARSE_OPT_SUBCOMMAND_OPTIONAL); + + if (!fn) { + struct bisect_terms terms = { 0 }; + + if (!argc) + usage_msg_opt(_("need a command"), git_bisect_usage, options); + + set_terms(&terms, "bad", "good"); + get_terms(&terms); + if (check_and_set_terms(&terms, argv[0])) + usage_msg_optf(_("unknown command: '%s'"), git_bisect_usage, + options, argv[0]); + res = bisect_state(&terms, argv, argc); + free_terms(&terms); + } else { + argc--; + argv++; + res = fn(argc, argv, prefix); + } /* * Handle early success diff --git a/git-bisect.sh b/git-bisect.sh index dfce4b4f44..9f6c8cc093 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -57,8 +57,6 @@ case "$#" in case "$cmd" in help) git bisect -h ;; - bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - git bisect--helper state "$cmd" "$@" ;; log) git bisect--helper log || exit ;; *) From patchwork Sat Nov 5 17:07:42 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: 13033113 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 13823C4332F for ; Sat, 5 Nov 2022 17:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230105AbiKERIx (ORCPT ); Sat, 5 Nov 2022 13:08:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiKERIb (ORCPT ); Sat, 5 Nov 2022 13:08:31 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA293BC99 for ; Sat, 5 Nov 2022 10:08:25 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id g24so7572552plq.3 for ; Sat, 05 Nov 2022 10:08:25 -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=xDPvE8N2/f3Iv929/7ntbkq4gOoVespdtKK07OyREl8=; b=R+fDvxNMfjEuSul/rLCrFOEsSrJcDfu0CmXBPqvxegN5hLyLl2mP75MxkGgwp8JwY/ kAHDXCzXLYFS4nt2Qsw4M7m7QhYl6SqADEEGi8uyNiNhGs5VBSvtowaWp3eV+XdTSYvw H5zZKZiAkY1nwbzF6K/m/sZ1lpAtDJwhlyvV71/t2RZhQGa7atSX/FW0il2BQF7ObAWQ Dl0+YG4G66Wgjkk9F0lR1dKbSrjbOt6VCxiGE0096pmqHErCisPsOtA0fUzw4LFaZfCt LKWvDE2xrv1+/OJ5vbdKJdn+4QJeuWyGVOehT8ulvf7/tadBLsoDskq5IXOurU4rG6D9 GJKw== 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=xDPvE8N2/f3Iv929/7ntbkq4gOoVespdtKK07OyREl8=; b=3JLLJQ1XhoU1suelehSA+Sbx4FDg+PBsJpoOawKlqvqR55DV7HK8LDSRnh79NqvPvW d9D3/eVmaKzeB2dHdlRmFIygXW2f55l38fZBAHXpIAasfFb+E85PilzusiyHCcDLquDQ ox05SQExdVzbInGTDUDPskfH8J83e/MXLJC+0/v5WfZslOkhzxM6lizdF9tS2qaU3m1U 0nYA06/UO7nPSoImnUOQIOlPmPdiqDLaDcuoOgGtzZjCuM3UiOttzWeN6xuUr7ODMNx0 O9oAOZiZTMKg8TGEVhf9RLvO5NWXQ9n4tuAni+UE08DqrznV1zFk0bYpclplv8rTn4V+ jNbw== X-Gm-Message-State: ACrzQf2pP/Z6qHT90CLCyB+JslG9OtyAcf+x98aUH7nKMFj2DCPmoXqT 0plRc5F1lSXtN6EwyT77BpUZJk/jiFM= X-Google-Smtp-Source: AMsMyM7Xtqa39TVTMuk52tjmduOXhjg67oCLmm+9fkm7ffBQhYEkmRLMHfNTGwVW73G/KasdsF/jOg== X-Received: by 2002:a17:903:2446:b0:187:11c6:6a1b with SMTP id l6-20020a170903244600b0018711c66a1bmr35439143pls.39.1667668104671; Sat, 05 Nov 2022 10:08:24 -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.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:24 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Subject: [PATCH 11/13] bisect--helper: remove subcommand state Date: Sun, 6 Nov 2022 00:07:42 +0700 Message-Id: <8037667da0f3d9f91c8f2aa477e2e95fb7f0c24b.1667667460.git.congdanhqx@gmail.com> 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 In previous change, we've made 'state' optional, and replaced all of its usage. Let's remove it, now. Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 3c7a16355a..d645fe89dc 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1349,18 +1349,6 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref return res; } -static int cmd_bisect__state(int argc, const char **argv, const char *prefix UNUSED) -{ - int res; - struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; - - set_terms(&terms, "bad", "good"); - get_terms(&terms); - res = bisect_state(&terms, argv, argc); - free_terms(&terms); - return res; -} - static int cmd_bisect__log(int argc, const char **argv UNUSED, const char *prefix UNUSED) { if (argc) @@ -1426,7 +1414,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) OPT_SUBCOMMAND("terms", &fn, cmd_bisect__terms), OPT_SUBCOMMAND("start", &fn, cmd_bisect__start), OPT_SUBCOMMAND("next", &fn, cmd_bisect__next), - OPT_SUBCOMMAND("state", &fn, cmd_bisect__state), OPT_SUBCOMMAND("log", &fn, cmd_bisect__log), OPT_SUBCOMMAND("replay", &fn, cmd_bisect__replay), OPT_SUBCOMMAND("skip", &fn, cmd_bisect__skip), From patchwork Sat Nov 5 17:07:43 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: 13033114 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 5EDC2C4332F for ; Sat, 5 Nov 2022 17:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbiKERJC (ORCPT ); Sat, 5 Nov 2022 13:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbiKERId (ORCPT ); Sat, 5 Nov 2022 13:08:33 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DCA8E0F2 for ; Sat, 5 Nov 2022 10:08:28 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d20so6493893plr.10 for ; Sat, 05 Nov 2022 10:08:28 -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=pe36tpdSj8UCmr24ubM4gc9ZGVKCE3Zo+tTI3crhQrM=; b=SkXI2ckxW6T3Nu8xWORXxkNM4fAz7OCZLpdwmXFL0Nq61cQcGRupXIM3a4rXCT87/C O4e2WA4V6He7DwW+j4I3RlnQ4rGSZcRRED494jZfbUd6OZDoThP84hsLFE0rjK4cJH+c DMQUzSMzmX5KNLlCZs6uq7XaRuvI4PsmRn2jTRSZ7BFM1MJJkF/dtjpDMgS0/LEeJPNQ oaAX5txQdLYczD0UDmZqB0OR6PLbq8JbRsrTFZpDD5cwvaDjdxfmxXLkn0mZmYWxvaLP 8RvYREXf6cidnCDfVCUvNpxhAJnqiIXkB6QQgMKN9XZXq1f96B+EQxVcBWLrVmFwFkI9 qCig== 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=pe36tpdSj8UCmr24ubM4gc9ZGVKCE3Zo+tTI3crhQrM=; b=gX9/sEHqzCULweSsQbY5q/CYqluCtfEWZwK575/5WPqlYo0ijadZhwahvi6o9evDLf +XYhoonTK0u3CFP1Y7rVUfxT6adN8rtrvFVqU+4thmm50H7nyyMduvuTTxPyDimk3qCv rQThpUiMhqLQ8HrLaf6Zpd8oZEGYfHg9MAp31NeTf6EINNG6dXdGriezRKcqdl91uQlm zHO1aaJmDiykJWHyutRv5c2He6jAzkp6wtCuT4N9hIsHXXYN5lpWRNBPbm6yDvYL546g lMX4PgmuO+bh/xLwzL2qLi3+aPLCL34Wz+4K8dCeQSMKtYINxzN2vTtVTCKT0SCVXxQh JrRw== X-Gm-Message-State: ACrzQf14Gf/n7zzfvm9bAffbhApCwoKpXwxMcuPLtIK2R7qDOLymxlWf Ya2tVPNCu1UVyxTmTSwSioYj1KzG+h8= X-Google-Smtp-Source: AMsMyM4xELppCuDzl1IWOaBLFkC//hdvqAhPd2WkJ9nGK2U3Gp4oSBrE1lGuR7CZXNEVVe0Ntte3wQ== X-Received: by 2002:a17:902:e154:b0:186:f0d5:1ac0 with SMTP id d20-20020a170902e15400b00186f0d51ac0mr40823649pla.15.1667668107281; Sat, 05 Nov 2022 10:08:27 -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.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:26 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= Subject: [PATCH 12/13] bisect--helper: log: allow arbitrary number of arguments Date: Sun, 6 Nov 2022 00:07:43 +0700 Message-Id: <3b13350977c5f8bc934805e908b57792ce1a9a4e.1667667460.git.congdanhqx@gmail.com> 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 In a later change, we would like to turn bisect into a builtin by renaming bisect--helper. However, there's an oddity that "git bisect log" accepts any number of arguments and it will just ignore them all. Let's prepare for the next step by ignoring any arguments passed to "git bisect--helper log" Signed-off-by: Đoàn Trần Công Danh --- builtin/bisect--helper.c | 4 +--- git-bisect.sh | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index d645fe89dc..e61ce6556c 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1349,10 +1349,8 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref return res; } -static int cmd_bisect__log(int argc, const char **argv UNUSED, const char *prefix UNUSED) +static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED) { - if (argc) - return error(_("'%s' requires 0 arguments"), "git bisect log"); return bisect_log(); } diff --git a/git-bisect.sh b/git-bisect.sh index 9f6c8cc093..f95b8103a9 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -57,8 +57,6 @@ case "$#" in case "$cmd" in help) git bisect -h ;; - log) - git bisect--helper log || exit ;; *) git bisect--helper "$cmd" "$@" ;; esac From patchwork Sat Nov 5 17:07:44 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: 13033115 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 4B9A3C433FE for ; Sat, 5 Nov 2022 17:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbiKERJD (ORCPT ); Sat, 5 Nov 2022 13:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbiKERIh (ORCPT ); Sat, 5 Nov 2022 13:08:37 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDF1E0CC for ; Sat, 5 Nov 2022 10:08:31 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id b21so7553903plc.9 for ; Sat, 05 Nov 2022 10:08:31 -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=/4SSqEtqlK1Fuz7wIYIxL89UjWGi22og4g/OSC1SzYc=; b=fr03NqbexZUT4/loFp7F+PZ3sTV1oOkF7eR/l8pLcB5fEXbHbtoUjDbg/wBRrPfckd aZEHYFQpcyauBUypvJGnylgYG2jxc79jgNJ1Wz5p+AAPL1YBKwPecCf4TnueKdMrtNkb FEPSrs0zkVk8vAjooproPb8vIqCpnPJhwrt921y9zx5tDTq2eycSYvNlZiam+ncRsiuC GmhSN9WGSd98MRUEOIEh4msNCrVl24SQNtEph7eAFziyruhLaoh4v1DqWnfG/vQPMuG6 PozmvHz5wYCf+6tha4zR2Es9WbBfNPk0aQwGR91+b+rkavMBFJclrEK4MWMLmjOy/hcJ Bg+g== 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=/4SSqEtqlK1Fuz7wIYIxL89UjWGi22og4g/OSC1SzYc=; b=dggHPgAjhcbd9zqQ8JJ5Cn4/5Fi1pBZ5iQK7z2+2Cj+v3Gttqj3RpBZvcGJPRNqbW4 hctEJ4pVt2HsS6/Xq0LXef2u3Grjj2HpuvV1u1VgHdgAfZMN/OdHitPGHRdSxNQYUuob SUB2CePEHtyfoFUXliehNLAVSdaElzRg17/AcVSU3gI7UeJPWmBD+uw7ZsYEzeypFxk4 2CrVgJZEsfJYqDZPxaMavYhi9gwgwS0pK9GbRAys1u3GauXU5ylQO5ZAw13bpFOmb/5a FOcIMHjMGHP4plomAFTyp5Fr0YMW6F00Zco7+5tD6j86hI4tfOTFAXjCqCtDKAMW4l9t y4iw== X-Gm-Message-State: ACrzQf18aqZRsQ0fpHwr1cDTWhjhXDFsGTB7D74J4ZUWUkIiDcUmStz3 XuLhcVwaUgCUWXHI/vzBpIU0LtVFNF0= X-Google-Smtp-Source: AMsMyM77umXmLisjR7yoAX98ILgiWk3iiBuEx9crpgux+51UPgxgLRGXWocu+7Hk5k7GFy/j4tbODA== X-Received: by 2002:a17:90b:f06:b0:212:cb07:fb82 with SMTP id br6-20020a17090b0f0600b00212cb07fb82mr58092335pjb.221.1667668110304; Sat, 05 Nov 2022 10:08:30 -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.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Nov 2022 10:08:29 -0700 (PDT) From: =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBEYW5o?= To: git@vger.kernel.org Cc: Johannes Schindelin , Taylor Blau , Jeff King , Christian Couder , =?utf-8?b?w4Z2YXIgQXJuZmrDtnI=?= =?utf-8?b?w7AgQmphcm1hc29u?= , Junio C Hamano , =?utf-8?b?xJBvw6BuIFRy4bqnbiBDw7RuZyBE?= =?utf-8?b?YW5o?= Subject: [PATCH 13/13] Turn `git bisect` into a full built-in Date: Sun, 6 Nov 2022 00:07:44 +0700 Message-Id: <0441cf255473ea3d2ca8bb2fc46874ec207bbcee.1667667460.git.congdanhqx@gmail.com> 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: Johannes Schindelin Now that the shell script hands off to the `bisect--helper` to do _anything_ (except to show the help), it is but a tiny step to let the helper implement the actual `git bisect` command instead. This retires `git-bisect.sh`, concluding a multi-year journey that many hands helped with, in particular Pranit Bauna, Tanushree Tumane and Miriam Rubio. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano Signed-off-by: Đoàn Trần Công Danh --- Makefile | 3 +-- builtin.h | 2 +- builtin/{bisect--helper.c => bisect.c} | 2 +- git.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) rename builtin/{bisect--helper.c => bisect.c} (99%) diff --git a/Makefile b/Makefile index 4927379184..78785c6b84 100644 --- a/Makefile +++ b/Makefile @@ -627,7 +627,6 @@ THIRD_PARTY_SOURCES = # interactive shell sessions without exporting it. unexport CDPATH -SCRIPT_SH += git-bisect.sh SCRIPT_SH += git-difftool--helper.sh SCRIPT_SH += git-filter-branch.sh SCRIPT_SH += git-merge-octopus.sh @@ -1137,7 +1136,7 @@ BUILTIN_OBJS += builtin/am.o BUILTIN_OBJS += builtin/annotate.o BUILTIN_OBJS += builtin/apply.o BUILTIN_OBJS += builtin/archive.o -BUILTIN_OBJS += builtin/bisect--helper.o +BUILTIN_OBJS += builtin/bisect.o BUILTIN_OBJS += builtin/blame.o BUILTIN_OBJS += builtin/branch.o BUILTIN_OBJS += builtin/bugreport.o diff --git a/builtin.h b/builtin.h index 8901a34d6b..aa955466b4 100644 --- a/builtin.h +++ b/builtin.h @@ -116,7 +116,7 @@ int cmd_am(int argc, const char **argv, const char *prefix); int cmd_annotate(int argc, const char **argv, const char *prefix); int cmd_apply(int argc, const char **argv, const char *prefix); int cmd_archive(int argc, const char **argv, const char *prefix); -int cmd_bisect__helper(int argc, const char **argv, const char *prefix); +int cmd_bisect(int argc, const char **argv, const char *prefix); int cmd_blame(int argc, const char **argv, const char *prefix); int cmd_branch(int argc, const char **argv, const char *prefix); int cmd_bugreport(int argc, const char **argv, const char *prefix); diff --git a/builtin/bisect--helper.c b/builtin/bisect.c similarity index 99% rename from builtin/bisect--helper.c rename to builtin/bisect.c index e61ce6556c..fc13f683a1 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect.c @@ -1403,7 +1403,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE return res; } -int cmd_bisect__helper(int argc, const char **argv, const char *prefix) +int cmd_bisect(int argc, const char **argv, const char *prefix) { int res = 0; parse_opt_subcommand_fn *fn = NULL; diff --git a/git.c b/git.c index 6662548986..a2deb15e46 100644 --- a/git.c +++ b/git.c @@ -492,7 +492,7 @@ static struct cmd_struct commands[] = { { "annotate", cmd_annotate, RUN_SETUP }, { "apply", cmd_apply, RUN_SETUP_GENTLY }, { "archive", cmd_archive, RUN_SETUP_GENTLY }, - { "bisect--helper", cmd_bisect__helper, RUN_SETUP }, + { "bisect", cmd_bisect, RUN_SETUP }, { "blame", cmd_blame, RUN_SETUP }, { "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG }, { "bugreport", cmd_bugreport, RUN_SETUP_GENTLY },