From patchwork Tue Feb 22 16:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755626 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 03969C433F5 for ; Tue, 22 Feb 2022 16:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234010AbiBVQax (ORCPT ); Tue, 22 Feb 2022 11:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231695AbiBVQax (ORCPT ); Tue, 22 Feb 2022 11:30:53 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 614A2166E1F for ; Tue, 22 Feb 2022 08:30:27 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id h6so34382101wrb.9 for ; Tue, 22 Feb 2022 08:30:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=+m/aieNUxti1udp6/tuXx1EdP5Pxoaz8caGLgixBNK0=; b=OELDgwph2ZrhcjWXCeXCVynGDrNvb9CbG6t8VlFbzbyPpQ1uUonHa2+QNLlw+xGz0X qZ1LSAK/uMGj9B7sThH9XsRU4rEcKNBELoUnO3wuCtqMDASeann51hSq5DNPDCPr5TIg 3uERsJ3WQprX8E4syAe5H3p/vIDkTnItwYfdC55a/SUo64qXjtaKzoCT+W3L1apbDazY 8FUz/+vzdWZfAtaCs30YQ0wpg0KtpnaeFv4mVGZuxHF3N79VAxxRngmwt9bwkIOMY8ja pPqeY1yp9vXZRePetMNXogv8ozFGAHubkVay0zHWJ7ag5Bks9isPDekGAa2pBftV/u74 eHqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=+m/aieNUxti1udp6/tuXx1EdP5Pxoaz8caGLgixBNK0=; b=slgXx3tfVW6u4mFd8tQQbp87U7qgAk6OURhXp0uUUpUDI84iiedZkoHVluZsjRGN5n U33WKLfipD/dyD0J0hilGvGZu/lGu58G8a8kGHjiEc4zRO9K9a0Judnr4RvHc425suRm 1/g6eMYbLxC18LIQbL81wNy4v03FIC39Pk0iSNm6Dg6em6LW6USt1+NTsxidTBhMZFig 9XhuVE307YsKRu+QtfErCkFV777jEfqjd7oefQyvXSTfYMhyGiZT7IS0ZYhuOIBcemDe kEmMU7bMQVLEmJuvC0IfamOh1rUYrCs6HGSWcp+bsy5mxyFCyKayJthKoSB0ECWulIfT O19g== X-Gm-Message-State: AOAM530ELwoxmkT0nPD3TMKXeOvEU/bIiegJtu7L0xfnubzGkAgIUPcp 4T/CukQlCCmkciYvvct9dU9NBhAkXRw= X-Google-Smtp-Source: ABdhPJxpINWLHQ2RiHntkwFRzUiZYqQthIFG9qr2cG2xYVXVv6wq7/tOM27r4khC/VpDSPkRvMC5CA== X-Received: by 2002:a5d:530c:0:b0:1e4:aabf:ad5f with SMTP id e12-20020a5d530c000000b001e4aabfad5fmr20185110wrv.28.1645547425806; Tue, 22 Feb 2022 08:30:25 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v20-20020a7bcb54000000b0037fa63db8aasm2838044wmj.5.2022.02.22.08.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:24 -0800 (PST) Message-Id: <81ca0d68cde6c1cfcf439b8b43016fd2b8e64d10.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:10 +0000 Subject: [PATCH v2 01/14] bisect run: fix the error message Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), we ported the `bisect run` subcommand to C, including the part that prints out an error message when the implicit `git bisect bad` or `git bisect good` failed. However, the error message was supposed to print out whether the state was "good" or "bad", but used a bogus (because non-populated) `args` variable for it. Helped-by: Elijah Newren Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 8 ++------ t/t6030-bisect-porcelain.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 28a2e6a5750..4208206af07 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1093,7 +1093,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) { int res = BISECT_OK; struct strbuf command = STRBUF_INIT; - struct strvec args = STRVEC_INIT; struct strvec run_args = STRVEC_INIT; const char *new_state; int temporary_stdout_fd, saved_stdout; @@ -1111,8 +1110,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) strvec_push(&run_args, command.buf); while (1) { - strvec_clear(&args); - printf(_("running %s\n"), command.buf); res = run_command_v_opt(run_args.v, RUN_USING_SHELL); @@ -1157,14 +1154,13 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) printf(_("bisect found first bad commit")); res = BISECT_OK; } else if (res) { - error(_("bisect run failed: 'git bisect--helper --bisect-state" - " %s' exited with error code %d"), args.v[0], res); + error(_("bisect run failed: 'git bisect" + " %s' exited with error code %d"), new_state, res); } else { continue; } strbuf_release(&command); - strvec_clear(&args); strvec_clear(&run_args); return res; } diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 1be85d064e7..720442de2eb 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -980,4 +980,14 @@ test_expect_success 'bisect visualize with a filename with dash and space' ' git bisect visualize -p -- "-hello 2" ' +test_expect_success 'testing' ' + git bisect reset && + git bisect start $HASH4 $HASH1 && + write_script test_script.sh <<-\EOF && + rm .git/BISECT* + EOF + test_must_fail git bisect run ./test_script.sh 2>error && + grep "git bisect good.*exited with error code" error +' + test_done From patchwork Tue Feb 22 16:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755628 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 09365C433EF for ; Tue, 22 Feb 2022 16:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234023AbiBVQa4 (ORCPT ); Tue, 22 Feb 2022 11:30:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234005AbiBVQax (ORCPT ); Tue, 22 Feb 2022 11:30:53 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314C6166E26 for ; Tue, 22 Feb 2022 08:30:28 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id f17so9557495wrh.7 for ; Tue, 22 Feb 2022 08:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=E38wZpp4FkHoZgeWxHWlwwjW9ujaAyYMiL9nw2foArY=; b=m+O/QmbYzibJtWkfZXI0WmqfePnSMaRahcRGg6EZBLt6V9V0xvctdl4RlTU1vBUwHj HFsxJ4jjIrbdqLOQZoz6hPkopz57Qfome0xibyntsqipWdvRFkvBoCylADv0UQhoGcks FhDbfOpVhex8ycq19RPe5AMHjWyf3gGE6ehgXdSYwMwuXrr9pF6DJEQrsYCE7s7iuHxj A/niIomIW4t5LPUJWHO511CeWNqcYgKSEc3c0XHsW9SolfzxyNr3LYFjHA+dmh3Jb3lp J+9x/1IiNALLLCTJ+GjbDIece+Xbs0AwT9tBf2h/QQ0L1gbpDfCId95t/JhaMoCSNS23 NEdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=E38wZpp4FkHoZgeWxHWlwwjW9ujaAyYMiL9nw2foArY=; b=yByMMjnU5wlfvUGsr55SR9BCjRiBPvXziu2twbBaoX6Oj+UJw24o75Gls2R8YJmIFU rQ+WoWHjZlcE1UDF3aReQHcPIap1Em6RUdhNxoS82gf71cBkTqXJ8fqjIbTGIzBwg9zX xS++ZqRHOylxd9HqsdClHfBaEPson2QH9HemZw/kk8HLPMRLdq81wGjRx3g9zvOLLnok JlYVW37nMq2LkuT7H8B0DGV/ZnAN6edPqWXmnQikbqf//5WRnwoYwM5jQr37ugtmmmlb /d56KdMPzUNmGaIR7BGCHdbMPnaW7F+3ZyNG+N1nH6/Q/swHrU0xf5qdQuvBFGmox65q IFWw== X-Gm-Message-State: AOAM533cdk2SMXc55T7ZrJYygbNoP/373zJbBF7JQwfY9b+eh1v3XzDG K2gXd1clToqq538hha8vMl9zUiWaas4= X-Google-Smtp-Source: ABdhPJzmq3f1/rpxoPZnoR+N7BURymTfwFRwDKbj8z3QTBSv/APpkPs2umttOmnHwF12Qg2LvQ/nEQ== X-Received: by 2002:adf:f312:0:b0:1e8:f4bb:5a5c with SMTP id i18-20020adff312000000b001e8f4bb5a5cmr19472630wro.668.1645547426669; Tue, 22 Feb 2022 08:30:26 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r14sm28749169wrz.84.2022.02.22.08.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:26 -0800 (PST) Message-Id: <4320101f2e01709ae33f7d81c9e4caa486fd9ad8.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:11 +0000 Subject: [PATCH v2 02/14] bisect: avoid double-quoting when printing the failed command Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We already quote the command via `sq_quote_argv()`, no need to enclose the result in an extraneous pair of single-quotes. Pointed out by Elijah Newren. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 4208206af07..ba6d90635a5 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1115,7 +1115,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) if (res < 0 || 128 <= res) { error(_("bisect run failed: exit code %d from" - " '%s' is < 0 or >= 128"), res, command.buf); + " %s is < 0 or >= 128"), res, command.buf); strbuf_release(&command); return res; } From patchwork Tue Feb 22 16:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755629 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 6A5F1C4332F for ; Tue, 22 Feb 2022 16:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbiBVQa5 (ORCPT ); Tue, 22 Feb 2022 11:30:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbiBVQay (ORCPT ); Tue, 22 Feb 2022 11:30:54 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6940166E27 for ; Tue, 22 Feb 2022 08:30:28 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id az13-20020a05600c600d00b003808a3380faso2358839wmb.1 for ; Tue, 22 Feb 2022 08:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=7429hhfNkiW/qxWbha+VARTUnOlAfrXqdV83gmgZ41o=; b=KoS9NN/SFrlD4P1cKAAt42YV5XlzqCiJlXqaLsu6hbvN1jRbjElE01Dgkl++I/hcej /1Fu/HnPlIgXTT+MoKtXvz/SWyu4/Go9nGX336OY6SVQovOa88OY68g29+MDXp90rXzL wjPhAwrH6vPZ37l6i04tIWQkvaNPUUFg7ETUwFGxY9R2oDZbYieif0bvH0S4eOVNdgMk WLEGVQCrN7JSAoSw+iNdL0rONBDgVhC/3y/SQIMhaK51VcLwpKsX3kxO1HrpZTaqWcCf gqg20sIZlSUJ2gJsh6qMRmLzw2DHSKXOTm+5Cnen7kp8fCe6WxuURZ4TSiwF8nRyGRCU CIVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=7429hhfNkiW/qxWbha+VARTUnOlAfrXqdV83gmgZ41o=; b=Tim27fhHqI0ZVazuSpPwXQtZVZ8p8XXGDa2ypHRCIIrGCoMEIdmvD3H+asaVduplky ui2O0cdf1dIltbh/ESfKddf7X9XLx4HJEgPL7hQ8UVLorOJS6ar+NQew0Fu536w4WHht b8mOqMJmWBu5cJoBmEG54oEn+hcwYwDw0wj060nfiQAZ1uWzC27ZHFZ60zG7Wc08vaeq qkDn5TaRkHHaQaRxzZEGPdFkMJp39H88wYzsiRe788clMYTztfICDdf/j/G+RcnjBnzf VJQiksGSagtenlBeD8UbKt5quHL2XosGm/vcSGrnBOv01ggcZ4XemlAGOQWmSD/KdRtW hlYg== X-Gm-Message-State: AOAM530E9l1U7u3mjGSBeNnVNFNzDAecwVvzKD6khw5q3aBar5on2gu5 CoI0HBHnUzyGAHHF8n+MzTW9vjzDpxM= X-Google-Smtp-Source: ABdhPJyFIrrexcsDBFa5qhrx/i/NBXqTtIxElYJpwrK/FluoukKWRDSjbJpzV6gxTIfbhnp7hhKUCA== X-Received: by 2002:a05:600c:1d28:b0:37c:a9d:d39f with SMTP id l40-20020a05600c1d2800b0037c0a9dd39fmr4037829wms.172.1645547427338; Tue, 22 Feb 2022 08:30:27 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z14sm2408410wrm.100.2022.02.22.08.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:27 -0800 (PST) Message-Id: <88d7173c86bbec7416cb43c408339c24ed015dce.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:12 +0000 Subject: [PATCH v2 03/14] bisect--helper: retire the --no-log option Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Turns out we actually never used it, anyway... Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ba6d90635a5..71a6f8f5192 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1182,7 +1182,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_VISUALIZE, BISECT_RUN, } cmdmode = 0; - int res = 0, nolog = 0; + int res = 0; struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), @@ -1206,8 +1206,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("visualize the bisection"), BISECT_VISUALIZE), OPT_CMDMODE(0, "bisect-run", &cmdmode, N_("use ... to automatically bisect."), BISECT_RUN), - OPT_BOOL(0, "no-log", &nolog, - N_("no log for BISECT_WRITE")), OPT_END() }; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; From patchwork Tue Feb 22 16:30:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755630 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 686F5C433F5 for ; Tue, 22 Feb 2022 16:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234044AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234020AbiBVQaz (ORCPT ); Tue, 22 Feb 2022 11:30:55 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEDBF166E26 for ; Tue, 22 Feb 2022 08:30:29 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id y5so1479145wmi.0 for ; Tue, 22 Feb 2022 08:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=nrizBZKt+VyuJsDADoVTARJpUUkpuKeTV9I+dT0npuQ=; b=ofEYtFoyjvX1e0igRozxy0jIutjtpSSFEmPVRUZ/g1tg0SCfGsdLf+k5DBASWiVuyU bcBolmtLPrbcGnulf3l1elLZQiPVFzfBjtZ1GGAwBESOdLhcahUPIeeAqXaFnvCuPCof Xsfzcu3TLwBWrLiFIJ5kaixDdXnbyQHJ+WQ+uIFN1PMP6qIt4Pm1b2R0zJN4d3g2N255 Zpu7P7GeTRksRgY4XHvDKX73c4bLtjHLUYmZA0NRVLZ9Zf9kvs1AmpnZRtOb7K1J4u5Q ZfZ8h/ovyi/mv1iFhlSSY2N2x6Zyh3MTxCn5IYc8h2n1CD9WQzHbAfwUs4Z16lPpGZFA qZ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=nrizBZKt+VyuJsDADoVTARJpUUkpuKeTV9I+dT0npuQ=; b=BzT2H7cYqeVY2aYmbK4pJuSIa34ybueR/e2P38e6QNj9vroo2ep6NmaLmokW98H1Qw F7jQsdMdDpj0fZ/mdgftl2hdXMB5eYZZwyAW6mL5vUO5zY1LlGVVb4bGAw/bMkB09jFy yRz3z/Fg7MqkooN8amrcTIaOxBRpxWRSJCoHjppj/Uhgc+XqKIjExz13dd5VScARhc9E 31Njns4+1WSsMCH/33xB6g8zRL3rVxeRTqRRaG5Tt5SDXS3/g8wOXDz1KzoR14JpNMcI QmriDjLtKY8jKjIc61LpGZjPzKGfQod+jKNHl+aOr0b80+lzRhhA/V5Vek3vzbyuzxlT L5OQ== X-Gm-Message-State: AOAM530/5HEkPH5/LtROfDkWjbqfkrSMacVlF+CxdFHtR67wjPhREVU+ tI7KgDRNHml7qEIdGP63njxKWGqhH5I= X-Google-Smtp-Source: ABdhPJxEvOjKvGqKnxMv+bOJjJb2xWP9c6oSwJPlMcSXbuvw6e4Aqw6Iyw1p2s5DbS1QpPqzJMKldg== X-Received: by 2002:a05:600c:4c13:b0:37b:c4c7:26bc with SMTP id d19-20020a05600c4c1300b0037bc4c726bcmr3996196wmp.169.1645547428189; Tue, 22 Feb 2022 08:30:28 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s7sm24261791wro.104.2022.02.22.08.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:27 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:13 +0000 Subject: [PATCH v2 04/14] bisect--helper: really retire --bisect-next-check Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In 911aba14205 (bisect--helper: retire `--bisect-next-check` subcommand, 2021-09-13), we removed the usage string and the implementation, but not actually the option. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 71a6f8f5192..4ee708e34c7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1170,7 +1170,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { BISECT_RESET = 1, - BISECT_NEXT_CHECK, BISECT_TERMS, BISECT_START, BISECT_AUTOSTART, @@ -1186,8 +1185,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-next-check", &cmdmode, - N_("check whether bad or good terms exist"), BISECT_NEXT_CHECK), OPT_CMDMODE(0, "bisect-terms", &cmdmode, N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-start", &cmdmode, From patchwork Tue Feb 22 16:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755631 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 AFB91C433FE for ; Tue, 22 Feb 2022 16:30:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbiBVQbI (ORCPT ); Tue, 22 Feb 2022 11:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbiBVQa4 (ORCPT ); Tue, 22 Feb 2022 11:30:56 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85078166E22 for ; Tue, 22 Feb 2022 08:30:30 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id h6so34382505wrb.9 for ; Tue, 22 Feb 2022 08:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=HQq8/iPgI/xyiQATgzq2+Mc24qRfPHzu/mhuo+izd9Q=; b=TIh3Gp4lZYCim5Mx6F5LilNPKBPcCzCGVguDdGWieLja6ikxPh9grmtMBD78LZDdqM pmVqWfPq9qTuIgISvC1XBN4DnEClAMd3HGyDVx61mRhAGwLiGE9xNEbxROYp8ZNuQGm0 JMXwTF17LgqY2lkgfwNbYUgwvvMqH/ZxOPuBOiZ6kAut17FyW2giou4nWZOnX525DS19 BAuHJGk/5ZPmUDJ5mqdzhg9v+TvrmGYkRPIrP8n/nUzGcMlJhh4Fntg3fp+KILR63D12 Tzhnyp55Onov6mNal3M/Ykknl2eQDu3ggl67Rljwsohu5z2tX8S8QXA8yKv0Y/fy+qXb eLvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=HQq8/iPgI/xyiQATgzq2+Mc24qRfPHzu/mhuo+izd9Q=; b=BtxGU8NkUnM7DWx8jhYJdD0tWfLGTmJDeig5EyhliCu6IwiEpXUA3F39VnF6ZYBnfH GNzFrHaxHK74w9u4h0Iyx8AMwmB+JL4bGVhxTswZHew4fibpmgCe/a2IvFp2kxAThyo0 EEiEGs72AuEuDWAE518BLIxm0Cs9CzRW4oYlPCE31iwmBYicsi+8ymutrmIC605b0FXZ Da/MpUOVL89vneuuQkGDQN0bhn/6tjVyrFhegccYI/lF+ZVCWQcIJwSgpTO5Tzi3Yn4r vPAbkZKHHWxE8AO1VfSu2NQd29YW6hU4hWTx92FcAoLAS5wLva0JElstmOw8/SDKBxhs NHog== X-Gm-Message-State: AOAM530HhvNJlQWkDKb91sOmHCJiftwea4mfwkF5Wi5o2MQl3ZSvYG+E CKQgUs7lVUT/exL0bFVAHC4AFHeZSMQ= X-Google-Smtp-Source: ABdhPJwUJib0XwqwhKGmjzPiFhESTNXd4PWzfeLGMz9olKJocU8dQuonrnuEfR4Oxf/mza315Hm4OQ== X-Received: by 2002:adf:f303:0:b0:1e7:aeab:ac6a with SMTP id i3-20020adff303000000b001e7aeabac6amr20636670wro.40.1645547428991; Tue, 22 Feb 2022 08:30:28 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y10sm2672698wmi.47.2022.02.22.08.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:28 -0800 (PST) Message-Id: <0d3db63bda6d6fe1de5be4912534594571a0ee29.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:14 +0000 Subject: [PATCH v2 05/14] bisect--helper: really retire `--bisect-autostart` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Since b0f6494f70f (bisect--helper: retire `--bisect-autostart` subcommand, 2020-10-15), the `--bisect-autostart` option is no more. But we kept the `enum` value of the command mode around. Let's drop it, too. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 4ee708e34c7..c7763be2c51 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1172,7 +1172,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_RESET = 1, BISECT_TERMS, BISECT_START, - BISECT_AUTOSTART, BISECT_NEXT, BISECT_STATE, BISECT_LOG, From patchwork Tue Feb 22 16:30:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755632 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 EFD36C433EF for ; Tue, 22 Feb 2022 16:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234036AbiBVQbJ (ORCPT ); Tue, 22 Feb 2022 11:31:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234027AbiBVQa5 (ORCPT ); Tue, 22 Feb 2022 11:30:57 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52B4C166E31 for ; Tue, 22 Feb 2022 08:30:31 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id p4so1726864wmg.1 for ; Tue, 22 Feb 2022 08:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=VcXD2hWLwntQ2CtjTP7AMQ9SvTJ37bqnOMIpNn2C5kY=; b=gbeBfEwPQTXCOiXUijZrnFM+0SyRjG+PMcGBve07V+YAhfs7g1co4h7SgGLG5d8xSX 1LAHEu9xovAwATOXV2y6SRDpSP4klsD4ieXZzEBdeGxP5UAJaUu2uww6L/Rra/iTQFOJ 6Ac6HGFiw6bHS1VNjM3ysDynO2tw2eegHBuVxOu/FHsmz7q3P6G/nSXm7Z5rn8YnTpEO 3kcmlhjkLJzdXJgO+2ms6dtcNSnTEo1H7E455sB0JeeCOTRdeoi13Fv4Dd42gpRrY3b0 XE49SA2tdizQlz2lnjOSVovbCnPX3q+vPGg1s3a0ENr1PSnOUXL8K5YcvOGtm7APv0Xu Riiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=VcXD2hWLwntQ2CtjTP7AMQ9SvTJ37bqnOMIpNn2C5kY=; b=SR6jb4+U7qrkdIeVFELQgnLIUbsusFgVgbEoObO6JWL5VCUKbJdbHPC4+jW8q8pH8O 8JTCaviOfHIrQzVApAZxseA7AC4gquHLR9SAxmLCscb5sOxd3XPnzAW8boHsMRRm6osb lZ20jFz5crQxnpGEF6i0KeWRc9tmaWNzRxWQvRR4+NgDhq/OcPo573t43jafDW7abRLc CYQ94UgF1kePBgYevMqoqcT+kyQWyfA9+JS+CDNcLZjzsNWe3AsIViXmvk3AOL5KcZbZ REFZcRQJDQV0A2Aye5QDnKw1IMur+Tzmfc6n2e6E7/Ghixv5euuzMBlXbqjf4s/HDf7L 2gaA== X-Gm-Message-State: AOAM530HRcu5h0ExOPpl0wY+N6B2WLdm69tH0A628QchWWHiYiSozfW2 1AxUrHaXoxyzhFaSYNby533PrBm/EVw= X-Google-Smtp-Source: ABdhPJyGm7bz+9esP+MKpr3bTy41IbKwC6CK5ttRh/ZIrLvkZvX8IDNkwsD2QAoqlbm+N7/yXG/niw== X-Received: by 2002:a7b:cc8f:0:b0:37b:dcdf:cf40 with SMTP id p15-20020a7bcc8f000000b0037bdcdfcf40mr4056273wma.99.1645547429811; Tue, 22 Feb 2022 08:30:29 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n5sm37108141wrm.3.2022.02.22.08.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:29 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:15 +0000 Subject: [PATCH v2 06/14] bisect--helper: using `--bisect-state` without an argument is a bug Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The `bisect--helper` command is not expected to be used directly by the user. Therefore, it is a bug if it receives no argument to the `--bisect-state` command mode, not a user error. Which means that we need to call `BUG()` instead of `die()`. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index c7763be2c51..fcddd7444a4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -856,7 +856,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a struct oid_array revs = OID_ARRAY_INIT; if (!argc) - return error(_("Please call `--bisect-state` with at least one argument")); + BUG("bisect_state() called without argument"); if (bisect_autostart(terms)) return BISECT_FAILED; From patchwork Tue Feb 22 16:30:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755633 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 495D3C433F5 for ; Tue, 22 Feb 2022 16:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234048AbiBVQbL (ORCPT ); Tue, 22 Feb 2022 11:31:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F6DD166E35 for ; Tue, 22 Feb 2022 08:30:32 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id x15so30943wrg.8 for ; Tue, 22 Feb 2022 08:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=mt/SR32s9SQd3S85z51Uk46xXwNP4IEbnlgYuVXE+gI=; b=UmhJ6SGFlr7RhevjxqYCYUgucn6dQCcLBNeRrOKuN8C3BMS/qA73QpnSoz0KLYO/vN RRr5Txmg++2aONgQhTfBfPq3fKrfP6p5VjmF4ElUuBmnsqxjFSwpel+m6n48PD0rEp1x bF0wOk6J/W29VeymUyXm7/eUHovnDu2Sl4Va66tiFwx1b+C8a7ljBDYu5Qvlf3ngnkJ9 A7ICLMfpchi371gzoUODO5qh8+hJgNeeOXjJBKtZvdzFxPdDJCp+HZgbFPQ5H3KQ6fas fFbHyUPZMbR4X/33wP6YDR/mLxMrjYQhIAVuA8pbeArid9t4yD2cvSKHr37CIT8EGfTA fkMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=mt/SR32s9SQd3S85z51Uk46xXwNP4IEbnlgYuVXE+gI=; b=S0RygZwInQa9z1o/0lrNilaf/r1SoPn6G3slZjC5wt3j7GkKpRbcbF82cuy/ZSHBlF 57slxr4T9s6zHGQ3jmn4EgDcsTIZMxeGSpStvRfmSkMvDYzc74KbWKL2ONSg1ZUWC07r FdZhZN6DT5LyfLQMrHnsB7Ao4pLZJFWfdeZ2JkCptJRECXbucWw2JJFGUpNR8xoHaA7I 4kRBJhRtx4hYncq8QZ+0F9POsaEY+RgUZ/RpbEJ/zTrdRXq3EUEXxA7c55inhVJzufkP MMylR8tvBGE0VTy3DNwsJFG0YGfNjWIjDM3Q0Phlh4kRI4AKbq99g5xFAQt7C4GC1aX1 XjFw== X-Gm-Message-State: AOAM53281lMEMK+PJ5QFuPFfVTgMZKDfh6bBja6eoCUqqshmHpJnRM41 gpx8X65O/SNBPnj4vWzh8oYxpb9cavY= X-Google-Smtp-Source: ABdhPJy/jNhhz+hUgUAFCiaG/y28buRdMZkM1v+MBeE1VJLGJnD2oiZZVU+sN+g84eF1W/G7oESgjw== X-Received: by 2002:a5d:5185:0:b0:1e5:78a3:7747 with SMTP id k5-20020a5d5185000000b001e578a37747mr20402198wrv.470.1645547430508; Tue, 22 Feb 2022 08:30:30 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j30sm2962256wms.2.2022.02.22.08.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:30 -0800 (PST) Message-Id: <0487701220b5b1e6c8212ed422ce4ebecca5fbe2.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:16 +0000 Subject: [PATCH v2 07/14] bisect--helper: align the sub-command order with git-bisect.sh Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We are about to retire the shell implementation of `git bisect`, or maybe better put: the remainder of the shell implementation (a shell of a script, if you want). In preparation for that, align the order of the sub-commands with the way the outgoing implementation presents them to the user. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 76 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index fcddd7444a4..31243a88a02 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1169,37 +1169,37 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - BISECT_RESET = 1, - BISECT_TERMS, - BISECT_START, - BISECT_NEXT, + BISECT_START = 1, BISECT_STATE, - BISECT_LOG, - BISECT_REPLAY, + BISECT_TERMS, BISECT_SKIP, + BISECT_NEXT, + BISECT_RESET, BISECT_VISUALIZE, + BISECT_REPLAY, + BISECT_LOG, BISECT_RUN, } cmdmode = 0; int res = 0; struct option options[] = { - OPT_CMDMODE(0, "bisect-reset", &cmdmode, - N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-terms", &cmdmode, - N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-start", &cmdmode, N_("start the bisect session"), BISECT_START), - OPT_CMDMODE(0, "bisect-next", &cmdmode, - N_("find the next bisection commit"), BISECT_NEXT), OPT_CMDMODE(0, "bisect-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), - OPT_CMDMODE(0, "bisect-log", &cmdmode, - N_("list the bisection steps so far"), BISECT_LOG), - OPT_CMDMODE(0, "bisect-replay", &cmdmode, - N_("replay the bisection process from the given file"), BISECT_REPLAY), + OPT_CMDMODE(0, "bisect-terms", &cmdmode, + N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-skip", &cmdmode, N_("skip some commits for checkout"), BISECT_SKIP), + OPT_CMDMODE(0, "bisect-next", &cmdmode, + N_("find the next bisection commit"), BISECT_NEXT), + OPT_CMDMODE(0, "bisect-reset", &cmdmode, + N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-visualize", &cmdmode, N_("visualize the bisection"), BISECT_VISUALIZE), + OPT_CMDMODE(0, "bisect-replay", &cmdmode, + N_("replay the bisection process from the given file"), BISECT_REPLAY), + OPT_CMDMODE(0, "bisect-log", &cmdmode, + N_("list the bisection steps so far"), BISECT_LOG), OPT_CMDMODE(0, "bisect-run", &cmdmode, N_("use ... to automatically bisect."), BISECT_RUN), OPT_END() @@ -1214,19 +1214,24 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case BISECT_RESET: - if (argc > 1) - return error(_("--bisect-reset requires either no argument or a commit")); - res = bisect_reset(argc ? argv[0] : NULL); + case BISECT_START: + set_terms(&terms, "bad", "good"); + res = bisect_start(&terms, argv, argc); + break; + case BISECT_STATE: + set_terms(&terms, "bad", "good"); + get_terms(&terms); + res = bisect_state(&terms, argv, argc); break; case BISECT_TERMS: if (argc > 1) return error(_("--bisect-terms requires 0 or 1 argument")); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); break; - case BISECT_START: + case BISECT_SKIP: set_terms(&terms, "bad", "good"); - res = bisect_start(&terms, argv, argc); + get_terms(&terms); + res = bisect_skip(&terms, argv, argc); break; case BISECT_NEXT: if (argc) @@ -1234,15 +1239,14 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_next(&terms, prefix); break; - case BISECT_STATE: - set_terms(&terms, "bad", "good"); - get_terms(&terms); - res = bisect_state(&terms, argv, argc); + case BISECT_RESET: + if (argc > 1) + return error(_("--bisect-reset requires either no argument or a commit")); + res = bisect_reset(argc ? argv[0] : NULL); break; - case BISECT_LOG: - if (argc) - return error(_("--bisect-log requires 0 arguments")); - res = bisect_log(); + case BISECT_VISUALIZE: + get_terms(&terms); + res = bisect_visualize(&terms, argv, argc); break; case BISECT_REPLAY: if (argc != 1) @@ -1250,14 +1254,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); break; - case BISECT_SKIP: - set_terms(&terms, "bad", "good"); - get_terms(&terms); - res = bisect_skip(&terms, argv, argc); - break; - case BISECT_VISUALIZE: - get_terms(&terms); - res = bisect_visualize(&terms, argv, argc); + case BISECT_LOG: + if (argc) + return error(_("--bisect-log requires 0 arguments")); + res = bisect_log(); break; case BISECT_RUN: if (!argc) From patchwork Tue Feb 22 16:30:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755634 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 A5E05C4332F for ; Tue, 22 Feb 2022 16:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234067AbiBVQbN (ORCPT ); Tue, 22 Feb 2022 11:31:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234028AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECBD9167F81 for ; Tue, 22 Feb 2022 08:30:32 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id d3so18777767wrf.1 for ; Tue, 22 Feb 2022 08:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=0/2yMfKj7qemE2ShouwPW7mCRvdo21HftDXt3BvzgL4=; b=LABoyHSeaFLVGv/f+vunpmc3lq+oFuBmmJABiqyqFDceuXLtHnxSIr12XW7Fsui8wI osogsVOr0wj94L1lOoVWQ/yplqjnk4lqsncS0JY2S2uywQQ9bcMmBdHEWnElFcn02kDL CvCWNQ5V+5TQS9eOHRpG/FRSFZGklKHN3/ZyDfHQLmtNRXvbvs33Qve0nV8GZBemCN38 zQceawuqbw1wT5n7a3M9DVc3C4EAns37yKKyHi+zYEa6lmyvXXwjE/lfeFKpgcugs5iP t+twOcEeDB0WPIA9qFAuoArnzyUJ0KAz/+lxGjSiPq/5M1P+OsCwiWvtc9LQTIXA6hyJ oQ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=0/2yMfKj7qemE2ShouwPW7mCRvdo21HftDXt3BvzgL4=; b=sAKI0R9k9vKy3tScN/ouGjncVq8W1y3NCx/Y7TQ5zRJwknZXXt09gDi0hqiMMeKt0K Dukfz7Ro0MmuNszR9URE61e9Yc+aWug9bzgAzYB/14pLDyiNfvxVM7X5o1kj2YdDwhcH wOkGZyhd9Wg29UmDGU6o+bQ8xGTWQNZkDQEya9j6/6383drAb0MG8hZvUQ/amPyU4/xk 2iO8TnY2o1HCsGry10Fo1UDHV70v1qM46pJQe4FG3L1BZ6K+VyhtfbKTPynxBq1t173/ 9w2gALMWeJB1myMvoW0uD1W4QH71iW6iBQL1euZUdoQlp3PnKXiZMPvRJzDxLbxcW+G/ eeyw== X-Gm-Message-State: AOAM531QjQyx9Md3TvaaSPcNqXe6v8Dhbj98Vtkyl3ynI4eg0C8P1HWh VlrjhCBXxYe5rmrxaxkEEQRsU6cjzEw= X-Google-Smtp-Source: ABdhPJz28dv/azzlDpBQXyMACH4dDxsh7yomc74WhfNERG4JyKttIDNPWCumwF79zsGOBjHWTuvfIw== X-Received: by 2002:adf:f284:0:b0:1e3:2576:245 with SMTP id k4-20020adff284000000b001e325760245mr20241420wro.529.1645547431355; Tue, 22 Feb 2022 08:30:31 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v2sm4418336wro.58.2022.02.22.08.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:30 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:17 +0000 Subject: [PATCH v2 08/14] bisect--helper: make `--bisect-state` optional Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin 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 `--bisect-state` option to be passed explicitly. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 14 ++++++++------ git-bisect.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 31243a88a02..39b3cd606f2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -26,8 +26,8 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" " [--no-checkout] [--first-parent] [ [...]] [--] [...]"), N_("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-state] (bad|new) []"), + N_("git bisect--helper [--bisect-state] (good|old) [...]"), N_("git bisect--helper --bisect-replay "), N_("git bisect--helper --bisect-skip [(|)...]"), N_("git bisect--helper --bisect-visualize"), @@ -1210,10 +1210,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) git_bisect_helper_usage, PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); - if (!cmdmode) - usage_with_options(git_bisect_helper_usage, options); - - switch (cmdmode) { + switch (cmdmode ? cmdmode : BISECT_STATE) { case BISECT_START: set_terms(&terms, "bad", "good"); res = bisect_start(&terms, argv, argc); @@ -1221,6 +1218,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) case BISECT_STATE: set_terms(&terms, "bad", "good"); get_terms(&terms); + if (!cmdmode && + (!argc || check_and_set_terms(&terms, argv[0]))) { + char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]); + usage_msg_opt(msg, git_bisect_helper_usage, options); + } res = bisect_state(&terms, argv, argc); break; case BISECT_TERMS: diff --git a/git-bisect.sh b/git-bisect.sh index 405cf76f2a3..fbf56649d7d 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -60,7 +60,7 @@ case "$#" in start) git bisect--helper --bisect-start "$@" ;; bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - git bisect--helper --bisect-state "$cmd" "$@" ;; + git bisect--helper "$cmd" "$@" ;; skip) git bisect--helper --bisect-skip "$@" || exit;; next) From patchwork Tue Feb 22 16:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755635 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 503F8C433EF for ; Tue, 22 Feb 2022 16:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234070AbiBVQbO (ORCPT ); Tue, 22 Feb 2022 11:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96BEB167F85 for ; Tue, 22 Feb 2022 08:30:33 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id d28so6665252wra.4 for ; Tue, 22 Feb 2022 08:30:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=2K0LnlFGfZitZBAVYFpb/JmqnEkv2TKRGX5K7BxiKu4=; b=XLHdQ+lyFb4oCWHJwHOxSpUdG8t8pr2PJ5JXmYsdj4aT835iwTlFnkuXINzO0uHUoc fkWUxCnpEV0yHHAr6FhMkaCY8H6tx4QLjWAg98+CI1prvUhAiA7AhxKHJvnXmLyWOFgg SEuQkG5Esfj0V59a7zcUBedgJNcjNhr9J7Og1HXUzgytkmJgfGfa5D/yxN5ExvnfDmAw faOQ/tR4TFVrvm4bXZKoYwpGP8OnKKSe9oobjX4hdWFDR+0VMKB2bq66OZ7V69/aHbdu H4wsM4C8tPPmgopy0kO7LF6nZRaiGbsVZUkVe5HJ50wa2muutEPnb0+qFeOQnq0RDQgg YX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=2K0LnlFGfZitZBAVYFpb/JmqnEkv2TKRGX5K7BxiKu4=; b=JvuHK2dxOySCmHI1aKh3WgMx55fENCVy/+NiBQEChGrd6CojbA0s9lvlE9KJsls4Gu r1nnxRC0uTFiALywHEvOXeD0FExKKu3cshO3Vs3e2Azyc+SFA/l4gXqfl8CtzRVnmVxT Gs369yFZ/RN+FUhvzLa8QLHRII8ON2UB4J7DiV4evDMXmd0fXxqNmia/2lUeLfVRAu9A vx6aw1zqyKhe+1qHSUn5BqY3JFrxhGs8Vv9XkPV7U0MFk+SWrLUhLY/ms7Y/W9Z2dEGS aaCRkv64vUqoNwk8N4QTFrgexhyxVSZj5Yq8MYs4LGv2zNvB+xnGxqDUIUYDAwoJWE2u 5nIg== X-Gm-Message-State: AOAM532Sdrce4Sa6++Em4/tnN7XXPhujFE7paNvCtn3lueaetiCePPHz skDXdVxUeTLI/NAk9gAUQn1gqLVLIb4= X-Google-Smtp-Source: ABdhPJzzInjHra0+7YdMND5Xh8ie42+SG52R/6Wym1cEtohtiVPqlcUvV+hr/gWmJswXuyogbXQ89Q== X-Received: by 2002:adf:e685:0:b0:1ea:8b11:d7a3 with SMTP id r5-20020adfe685000000b001ea8b11d7a3mr3332035wrm.545.1645547432074; Tue, 22 Feb 2022 08:30:32 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n15sm25967477wri.33.2022.02.22.08.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:31 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:18 +0000 Subject: [PATCH v2 09/14] bisect--helper: move the `BISECT_STATE` case to the end Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In preparation for replacing the command-mode parsing in `bisect--helper` with an if/else if/else chain, let's move the one command that will be implicit (i.e. what will become the final `else` without any `if`) to the end. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 39b3cd606f2..ba047ee0fc8 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1215,16 +1215,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_start(&terms, argv, argc); break; - case BISECT_STATE: - set_terms(&terms, "bad", "good"); - get_terms(&terms); - if (!cmdmode && - (!argc || check_and_set_terms(&terms, argv[0]))) { - char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]); - usage_msg_opt(msg, git_bisect_helper_usage, options); - } - res = bisect_state(&terms, argv, argc); - break; case BISECT_TERMS: if (argc > 1) return error(_("--bisect-terms requires 0 or 1 argument")); @@ -1267,6 +1257,16 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_run(&terms, argv, argc); break; + case BISECT_STATE: + set_terms(&terms, "bad", "good"); + get_terms(&terms); + if (!cmdmode && + (!argc || check_and_set_terms(&terms, argv[0]))) { + char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]); + usage_msg_opt(msg, git_bisect_helper_usage, options); + } + res = bisect_state(&terms, argv, argc); + break; default: BUG("unknown subcommand %d", cmdmode); } From patchwork Tue Feb 22 16:30:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755636 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 08222C433EF for ; Tue, 22 Feb 2022 16:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234071AbiBVQbQ (ORCPT ); Tue, 22 Feb 2022 11:31:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B01A9167F8B for ; Tue, 22 Feb 2022 08:30:34 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id l123-20020a1c2581000000b0037b9d960079so2386828wml.0 for ; Tue, 22 Feb 2022 08:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=PQkUAfKeX5SLmX/s3QRqfcVmlnFv15MPwnW0ew/LNlA=; b=ONOnaXKNkc2NaX1PCQgAQzLlKnI1pGOZRMHt4EjeAnZaOXe6mUpnEdfsGoOER8hW0D 1WWIZV+LczLiuJo4z/T9YRYBPn0YJngQVshJ3XUrIweWXWDtkRjrTSyNFXGcq3eWIxPB XNnshRjFdUZ67aLxzxW/kqdRoF2tbjBra80GKya/jzxAl005K07fycSVIYkg9PQFjk+k dwXyVkbWCyN6za5ZbgoVEuYd6IwUGVXNxunXAfezurWrBojQRlSrTFuNg5mcPTYQVx+1 AJ46ZQn3E3g+d+Ye40WJboOHUWNh4LIbo29rcNK5L4TrK8hCvYmaFM9CiV9cfy69WM4p yFxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=PQkUAfKeX5SLmX/s3QRqfcVmlnFv15MPwnW0ew/LNlA=; b=YwmykJIPTqyP7c/9ZwVlTw2W7MiA8YMQYeij0KVFXBkkxtwvjSB28xs0380fVUV5qY x3N2XxAE+hBxKfSCmORVQ5HFLgDUQuA0Y2PBVbEPY1xCwC32ixB4DCyxfLDAzsg3s/zU wVStEfUPOsqm6SOVR1PGy0NC1OuI8+keigyz05y6j2QAOIq4FMYXXp7OaGK35fJGd9FG Clg3QY5PxWIkViUSs5LHMLd8Sx+je8AkXkDv/W6NOLL1eP0jAidYkWN8mcEF5Cv3xAlF mhROruGvOJm+EgYkBZl71EM7BRqaLLvFqVtR1rQejOIUBr0mwyqt1jnOic7HiD39yekV Bing== X-Gm-Message-State: AOAM5301GCMgNIIrXXGbeNV9CppXVXj5l8vcFH5rRr4ZyZglq0Y+u31h lrBoi2qbFUJ0GcErVHK51161nHMB0+g= X-Google-Smtp-Source: ABdhPJyDESZEql0/V/pQQKapQIxo04IMAU881lwxErSLUdUOed+6Vc4FmGN646c5CxCndfqzoPk4mA== X-Received: by 2002:a1c:2742:0:b0:37b:b481:321f with SMTP id n63-20020a1c2742000000b0037bb481321fmr4053075wmn.56.1645547432926; Tue, 22 Feb 2022 08:30:32 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j6sm41675937wrt.70.2022.02.22.08.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:32 -0800 (PST) Message-Id: <208f8fa48512377e6d8f88c5c89f63692a792ccc.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:19 +0000 Subject: [PATCH v2 10/14] bisect--helper: return only correct exit codes in `cmd_*()` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Exit codes cannot be negative, but `error()` returns -1. Let's just go with the common pattern and call `die()` in `cmd_bisect__helper()` when incorrect arguments were detected. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ba047ee0fc8..5228964937d 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1217,7 +1217,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) break; case BISECT_TERMS: if (argc > 1) - return error(_("--bisect-terms requires 0 or 1 argument")); + die(_("--bisect-terms requires 0 or 1 argument")); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); break; case BISECT_SKIP: @@ -1227,13 +1227,13 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) break; case BISECT_NEXT: if (argc) - return error(_("--bisect-next requires 0 arguments")); + die(_("--bisect-next requires 0 arguments")); get_terms(&terms); res = bisect_next(&terms, prefix); break; case BISECT_RESET: if (argc > 1) - return error(_("--bisect-reset requires either no argument or a commit")); + die(_("--bisect-reset requires either no argument or a commit")); res = bisect_reset(argc ? argv[0] : NULL); break; case BISECT_VISUALIZE: @@ -1242,18 +1242,18 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) break; case BISECT_REPLAY: if (argc != 1) - return error(_("no logfile given")); + die(_("no logfile given")); set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); break; case BISECT_LOG: if (argc) - return error(_("--bisect-log requires 0 arguments")); + die(_("--bisect-log requires 0 arguments")); res = bisect_log(); break; case BISECT_RUN: if (!argc) - return error(_("bisect run failed: no command provided.")); + die(_("bisect run failed: no command provided.")); get_terms(&terms); res = bisect_run(&terms, argv, argc); break; From patchwork Tue Feb 22 16:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755639 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 9CC69C4332F for ; Tue, 22 Feb 2022 16:30:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234075AbiBVQbV (ORCPT ); Tue, 22 Feb 2022 11:31:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234039AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF57B167F95 for ; Tue, 22 Feb 2022 08:30:35 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id x15so31225wrg.8 for ; Tue, 22 Feb 2022 08:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=+WtbEiJLuTOp06tMnFg0vJAku9FUpDs7h7Qt7ARx3GA=; b=PUv2HMk2mfA47pj2U45/XU6HTXVRlUpV/TBmyKctVxDCBg97yNuasrUec8EK+BRbY1 TcOAR1aMkbcjF/ftmF5tZwCZp5Fufq9/MbiuIU9MghNFVdYoBct72PwnYD6kI67YFV5H d9HG74l0T5qv0Jb/0AYabC5bxFtnX2CHrHM6P+zEJDSz62/O92/R9260CWvckV9V7pPL BsXF2xHqpaiO2vzkxxBVOKa7oDILMLS8fdl+dGK5Um4J/vPRXoVdXSyCRW0+DVclLTpO h6wVvOkzzdne31CMw7XtmNm5Z7or/L35dd+twdEZIMqJQuplQb0ZKmuvQT3EzQILgTr9 /ePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=+WtbEiJLuTOp06tMnFg0vJAku9FUpDs7h7Qt7ARx3GA=; b=lED1I8kVsc6+sD6rNjErSNzLgeEuNJ4Fp4fw4oMGEftZuc38Q7iMI7MsSthytyZcDj 35NPM5YyvQzciQoD/Y7NCtXmWfI95/Odgl1ww58Zy4NF/bcbwDRIjVTD2Twmz4nw1EMy SIgFB002eakkKswBHLPouuQx3TNvpmUYm2mRcvtRMW4oSYY1FknbT3yB9LmpeRM+vFhx sFeHFNqe7mMFThQejmbIWd3Xya8BEWilYjKgK/Xe8jtpnUrh2R7DAH6LvG9nD2WBm3H5 jrbn2sgiBvK2tI7dAbhIKdHUILXdIONfTnaIj1lCySoOw3TGzjor3yAUvDM4uvRVdNsZ K8vA== X-Gm-Message-State: AOAM531iAA2C/lewkZeo8QX98+5dxJBA86KktKLbFF9T1B+QG7WS6vZ8 2xqlqTjP8d5ElMX6v4PNlJxVMf6QAZg= X-Google-Smtp-Source: ABdhPJxh8yqWZifPUF/87SHZfVtLE3vtPjz8VvORWmWHu+kUobp9AOM4VTuinea/t9SNK9/W9yfABQ== X-Received: by 2002:a5d:678b:0:b0:1ed:9f21:d36 with SMTP id v11-20020a5d678b000000b001ed9f210d36mr63634wru.550.1645547433555; Tue, 22 Feb 2022 08:30:33 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i9sm33156484wrf.79.2022.02.22.08.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:33 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:20 +0000 Subject: [PATCH v2 11/14] bisect: move even the option parsing to `bisect--helper` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin On our journey to a fully built-in `git bisect`, this is the second-to-last step. Side note: The `if (!strcmp(...)) ... else if (!strcmp(...)) ... else if (!strcmp(...)) ...` chain seen in this patch was not actually the first idea how to convert the command modes to sub-commands. Since the `bisect--helper` command already used the `parse-opions` API with neatly set-up command modes, naturally the idea was to use `PARSE_OPT_NODASH` to support proper sub-commands instead. However, the `parse-options` API is not set up for that, and even after making that option work with long options, it turned out that `STOP_AT_NON_OPTION` and `KEEP_UNKNOWN` would have to be used but these options were not designed to work together. So it would appear as if a lot of work would have to be done just to be able to use `parse_options()` just to parse the sub-command, instead of a simple `if...else if` chain, the latter being a dramatically simpler implementation. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 133 ++++++++++++++++----------------------- git-bisect.sh | 49 +-------------- 2 files changed, 56 insertions(+), 126 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 5228964937d..ef0b06d594b 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,18 +20,34 @@ 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 []"), - N_("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] [ [...]] [--] [...]"), - N_("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 [(|)...]"), - N_("git bisect--helper --bisect-visualize"), - N_("git bisect--helper --bisect-run ..."), +static const char * const git_bisect_usage[] = { + N_("git bisect help\n" + "\tprint this long help message."), + N_("git bisect start [--term-{new,bad}= --term-{old,good}=]\n" + "\t\t [--no-checkout] [--first-parent] [ [...]] [--] [...]\n" + "\treset bisect state and start bisection."), + N_("git bisect (bad|new) []\n" + "\tmark a known-bad revision/\n" + "\t\ta revision after change in a given property."), + N_("git bisect (good|old) [...]\n" + "\tmark ... known-good revisions/\n" + "\t\trevisions before change in a given property."), + N_("git bisect terms [--term-good | --term-bad]\n" + "\tshow the terms used for old and new commits (default: bad, good)"), + N_("git bisect skip [(|)...]\n" + "\tmark ... untestable revisions."), + N_("git bisect next\n" + "\tfind next bisection to test and check it out."), + N_("git bisect reset []\n" + "\tfinish bisection search and go back to commit."), + N_("git bisect (visualize|view)\n" + "\tshow bisect status in gitk."), + N_("git bisect replay \n" + "\treplay bisection log."), + N_("git bisect log\n" + "\tshow bisect log."), + N_("git bisect run ...\n" + "\tuse ... to automatically bisect."), NULL }; @@ -1168,108 +1184,69 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { - enum { - BISECT_START = 1, - BISECT_STATE, - BISECT_TERMS, - BISECT_SKIP, - BISECT_NEXT, - BISECT_RESET, - BISECT_VISUALIZE, - BISECT_REPLAY, - BISECT_LOG, - BISECT_RUN, - } cmdmode = 0; int res = 0; struct option options[] = { - OPT_CMDMODE(0, "bisect-start", &cmdmode, - N_("start the bisect session"), BISECT_START), - OPT_CMDMODE(0, "bisect-state", &cmdmode, - N_("mark the state of ref (or refs)"), BISECT_STATE), - OPT_CMDMODE(0, "bisect-terms", &cmdmode, - N_("print out the bisect terms"), BISECT_TERMS), - OPT_CMDMODE(0, "bisect-skip", &cmdmode, - N_("skip some commits for checkout"), BISECT_SKIP), - OPT_CMDMODE(0, "bisect-next", &cmdmode, - N_("find the next bisection commit"), BISECT_NEXT), - OPT_CMDMODE(0, "bisect-reset", &cmdmode, - N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-visualize", &cmdmode, - N_("visualize the bisection"), BISECT_VISUALIZE), - OPT_CMDMODE(0, "bisect-replay", &cmdmode, - N_("replay the bisection process from the given file"), BISECT_REPLAY), - OPT_CMDMODE(0, "bisect-log", &cmdmode, - N_("list the bisection steps so far"), BISECT_LOG), - OPT_CMDMODE(0, "bisect-run", &cmdmode, - N_("use ... to automatically bisect."), BISECT_RUN), OPT_END() }; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; + const char *command = argc > 1 ? argv[1] : "help"; - argc = parse_options(argc, argv, prefix, options, - git_bisect_helper_usage, - PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); + if (!strcmp("-h", command) || !strcmp("help", command)) + usage_with_options(git_bisect_usage, options); - switch (cmdmode ? cmdmode : BISECT_STATE) { - case BISECT_START: + argc -= 2; + argv += 2; + + if (!strcmp("start", command)) { set_terms(&terms, "bad", "good"); res = bisect_start(&terms, argv, argc); - break; - case BISECT_TERMS: + } else if (!strcmp("terms", command)) { if (argc > 1) - die(_("--bisect-terms requires 0 or 1 argument")); + die(_("'terms' requires 0 or 1 argument")); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); - break; - case BISECT_SKIP: + } else if (!strcmp("skip", command)) { set_terms(&terms, "bad", "good"); get_terms(&terms); res = bisect_skip(&terms, argv, argc); - break; - case BISECT_NEXT: + } else if (!strcmp("next", command)) { if (argc) - die(_("--bisect-next requires 0 arguments")); + die(_("'next' requires 0 arguments")); get_terms(&terms); res = bisect_next(&terms, prefix); - break; - case BISECT_RESET: + } else if (!strcmp("reset", command)) { if (argc > 1) - die(_("--bisect-reset requires either no argument or a commit")); + die(_("'reset' requires either no argument or a commit")); res = bisect_reset(argc ? argv[0] : NULL); - break; - case BISECT_VISUALIZE: + } else if (one_of(command, "visualize", "view", NULL)) { get_terms(&terms); res = bisect_visualize(&terms, argv, argc); - break; - case BISECT_REPLAY: + } else if (!strcmp("replay", command)) { if (argc != 1) die(_("no logfile given")); set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); - break; - case BISECT_LOG: + } else if (!strcmp("log", command)) { if (argc) - die(_("--bisect-log requires 0 arguments")); + die(_("'log' requires 0 arguments")); res = bisect_log(); - break; - case BISECT_RUN: + } else if (!strcmp("run", command)) { if (!argc) die(_("bisect run failed: no command provided.")); get_terms(&terms); res = bisect_run(&terms, argv, argc); - break; - case BISECT_STATE: + } else { set_terms(&terms, "bad", "good"); get_terms(&terms); - if (!cmdmode && - (!argc || check_and_set_terms(&terms, argv[0]))) { - char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]); - usage_msg_opt(msg, git_bisect_helper_usage, options); + if (check_and_set_terms(&terms, command)) { + char *msg = xstrfmt(_("unknown command: '%s'"), command); + usage_msg_opt(msg, git_bisect_usage, options); } + /* shift the `command` back in */ + argc++; + argv--; res = bisect_state(&terms, argv, argc); - break; - default: - BUG("unknown subcommand %d", cmdmode); } + free_terms(&terms); /* diff --git a/git-bisect.sh b/git-bisect.sh index fbf56649d7d..028d39cd9ce 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -34,51 +34,4 @@ Please use "git help bisect" to get the full man page.' OPTIONS_SPEC= . git-sh-setup -TERM_BAD=bad -TERM_GOOD=good - -get_terms () { - if test -s "$GIT_DIR/BISECT_TERMS" - then - { - read TERM_BAD - read TERM_GOOD - } <"$GIT_DIR/BISECT_TERMS" - fi -} - -case "$#" in -0) - usage ;; -*) - cmd="$1" - get_terms - shift - case "$cmd" in - help) - git bisect -h ;; - start) - git bisect--helper --bisect-start "$@" ;; - bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - git bisect--helper "$cmd" "$@" ;; - skip) - git bisect--helper --bisect-skip "$@" || exit;; - next) - # Not sure we want "next" at the UI level anymore. - git bisect--helper --bisect-next "$@" || exit ;; - visualize|view) - git bisect--helper --bisect-visualize "$@" || exit;; - reset) - git bisect--helper --bisect-reset "$@" ;; - replay) - git bisect--helper --bisect-replay "$@" || exit;; - log) - git bisect--helper --bisect-log || exit ;; - run) - git bisect--helper --bisect-run "$@" || exit;; - terms) - git bisect--helper --bisect-terms "$@" || exit;; - *) - usage ;; - esac -esac +exec git bisect--helper "$@" From patchwork Tue Feb 22 16:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755640 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 3E612C433EF for ; Tue, 22 Feb 2022 16:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234076AbiBVQbW (ORCPT ); Tue, 22 Feb 2022 11:31:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DE39167F98 for ; Tue, 22 Feb 2022 08:30:36 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id x3-20020a05600c21c300b0037c01ad715bso2277237wmj.2 for ; Tue, 22 Feb 2022 08:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Ww5wUb8C1NNFa9kIf3WduYzn2764k0AZ5kVmtw0osZw=; b=J6a1socL865zKS+59+Vd8b9HjMcMvWG9MIPaAd6U+OC+b1h/VBVJfsm0KwZhq1PdSl ALfzk3yr8b+aqxfu2d/eK73I19sxd2LjkM5tWYd3X9Ta0DMPZZDeTFVTOphqpmNAVejM 8P1PbSq7ItbI1HQUUvX8coLtvBfli+xhw2apzPBTvkpvGv5Dz4ipPS7mZdTpod5j3K0J Qie7ZJvD/jVoINVAe9LGi/y/zRG49otBTW208LKKwl94Phk5tX5py0NCY/5w6NSyCsY9 PRJ3lcnjTPRFkC/RgWoDT5eAAL3SkRX3dKmdm7fK74z8SVPZc+J1s4zQUGnLCcgYKEXV x37Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Ww5wUb8C1NNFa9kIf3WduYzn2764k0AZ5kVmtw0osZw=; b=bRNxl1vmDtnkznYOI3GQKqlnXTH7NzQAGFuJjY2ZrbK+MDf2EbTl3deHYuHb11lBSj qxD9HR4goLiIdOWZeV6UbyDw/TqS7I+VBBOmigN6KpuZ3I10TbdK9utbaxMibQucEFN2 IFg4yRP/rbYO39Ep1oBAfwfhIW9KyE0dtUw+6g2Mts83ZwjRtVpsuawHdpN0nouBdBDM rY35AtnFF1r/N2B3yffs8C2jNDcchCoWqzdAXFHyaoJ+wG5jgGo6J2zRNu0chAY7zEvT kM6aiVJf0SjbHbP6S3OdlpHA1BGECMirT/sHmHAVRl2DEYjfDeMBIi+jW7PjC13Xgo10 EpDw== X-Gm-Message-State: AOAM53111cDl7Hq1DdZXQU/uCvCgndhbQbxfb9J+ed4bamNsRzicFLGW AxOEueKMMX6DnkwXugcu27w84z55TAQ= X-Google-Smtp-Source: ABdhPJxzClQFwOBaX9BuWIX/5qZrfaPEZhdfENCm7g6JjhXLtq+IvcZZ1yGxIGvehfsmKJKnQoFvHQ== X-Received: by 2002:a05:600c:19d2:b0:37b:b8cc:5ca5 with SMTP id u18-20020a05600c19d200b0037bb8cc5ca5mr4116487wmq.22.1645547434912; Tue, 22 Feb 2022 08:30:34 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r2sm42968039wrt.65.2022.02.22.08.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:34 -0800 (PST) Message-Id: <7db4b03b66834ff78507303532af516206a22486.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:21 +0000 Subject: [PATCH v2 12/14] Turn `git bisect` into a full built-in Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin 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 --- Makefile | 3 +-- builtin.h | 2 +- builtin/{bisect--helper.c => bisect.c} | 8 +++--- git-bisect.sh | 37 -------------------------- git.c | 2 +- 5 files changed, 7 insertions(+), 45 deletions(-) rename builtin/{bisect--helper.c => bisect.c} (99%) delete mode 100755 git-bisect.sh diff --git a/Makefile b/Makefile index 5580859afdb..ce2eabeca58 100644 --- a/Makefile +++ b/Makefile @@ -595,7 +595,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 @@ -1064,7 +1063,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 8a58743ed63..b5567ea3a9d 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 ef0b06d594b..1493d7d1d96 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect.c @@ -20,7 +20,7 @@ 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_usage[] = { +static const char * const builtin_bisect_usage[] = { N_("git bisect help\n" "\tprint this long help message."), N_("git bisect start [--term-{new,bad}= --term-{old,good}=]\n" @@ -1182,7 +1182,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) } } -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; struct option options[] = { @@ -1192,7 +1192,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) const char *command = argc > 1 ? argv[1] : "help"; if (!strcmp("-h", command) || !strcmp("help", command)) - usage_with_options(git_bisect_usage, options); + usage_with_options(builtin_bisect_usage, options); argc -= 2; argv += 2; @@ -1239,7 +1239,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); if (check_and_set_terms(&terms, command)) { char *msg = xstrfmt(_("unknown command: '%s'"), command); - usage_msg_opt(msg, git_bisect_usage, options); + usage_msg_opt(msg, builtin_bisect_usage, options); } /* shift the `command` back in */ argc++; diff --git a/git-bisect.sh b/git-bisect.sh deleted file mode 100755 index 028d39cd9ce..00000000000 --- a/git-bisect.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -USAGE='[help|start|bad|good|new|old|terms|skip|next|reset|visualize|view|replay|log|run]' -LONG_USAGE='git bisect help - print this long help message. -git bisect start [--term-{new,bad}= --term-{old,good}=] - [--no-checkout] [--first-parent] [ [...]] [--] [...] - reset bisect state and start bisection. -git bisect (bad|new) [] - mark a known-bad revision/ - a revision after change in a given property. -git bisect (good|old) [...] - mark ... known-good revisions/ - revisions before change in a given property. -git bisect terms [--term-good | --term-bad] - show the terms used for old and new commits (default: bad, good) -git bisect skip [(|)...] - mark ... untestable revisions. -git bisect next - find next bisection to test and check it out. -git bisect reset [] - finish bisection search and go back to commit. -git bisect (visualize|view) - show bisect status in gitk. -git bisect replay - replay bisection log. -git bisect log - show bisect log. -git bisect run ... - use ... to automatically bisect. - -Please use "git help bisect" to get the full man page.' - -OPTIONS_SPEC= -. git-sh-setup - -exec git bisect--helper "$@" diff --git a/git.c b/git.c index edda922ce6d..a8500132a28 100644 --- a/git.c +++ b/git.c @@ -490,7 +490,7 @@ static struct cmd_struct commands[] = { { "annotate", cmd_annotate, RUN_SETUP | NO_PARSEOPT }, { "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 }, From patchwork Tue Feb 22 16:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755638 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 691A6C433EF for ; Tue, 22 Feb 2022 16:30:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233703AbiBVQbU (ORCPT ); Tue, 22 Feb 2022 11:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234045AbiBVQbG (ORCPT ); Tue, 22 Feb 2022 11:31:06 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79412167F9D for ; Tue, 22 Feb 2022 08:30:37 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id az13-20020a05600c600d00b003808a3380faso2359302wmb.1 for ; Tue, 22 Feb 2022 08:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=k6msMRouowcPy1JbPOTM76KbYM5kdF+S736MfpKzJK4=; b=kHDgvGXACEnGE0uo9U+wVx4xJL1cCdBFSiFm9WL6+kICahlNeKKyMiyJXgl9LHd7E4 fWzC41+cz/Ihs1ceP4SRyWWqut1co3XHjNDf9sD7GDpnT6oCIgGEjdbTZJ50gaqOX8bL emSCDGemwBsOxNqSvVACmbcbAh8UZN+B4mKVg633s8QwgptBVBhE61YaV+LvMTyOFnCF eaCYDsaJsaQydQdptTooCMe1p/zvM2LU09B4A5SnYrI0e2u7n2Ff4Uv+R139wqIgP9jy i3oaDW+c7anHN2yUvjRBTDkM0l+0xUnVka122DOUHlB7A0ITqDHNyHf9iHAh7BqCCKHr WyIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=k6msMRouowcPy1JbPOTM76KbYM5kdF+S736MfpKzJK4=; b=nq45eaNGmPNf2A6fpG1S1qnpeR4T3TWkVBy+YurOdpwDvKb8vF4/6avoXJvsZC2++K bAixmoDhIR46jnIDWlh8ue+wA8sUXq62DJAbP7PyZOXiOD19ouWkHCkgirGNpjIkNQ1J 6vKt38ve2m9yooMIM5mvxND86qgxf9afcnRcJ/reTmf44Zdwq7crTfSyFzUetiuyUtEm rUkRI73ua+uhcaJmGCBZf2V3zzv8iO98yokOv9Oy0M9cTbCO//dA3qC9xHwAmsXUm+5x 0jdvhhhsca9oAuI8NGe87+BWLTV9Ijn5wZuXJ6bh5u/b4DDfLiF6kn9aLn+ssAnfskir SqnQ== X-Gm-Message-State: AOAM531E5UCaoAnPWn8QlBTNIsZkBaM8i7xFHc6+xdmJdNghjHSEONSh ToPI5z2uVf77M3oCEg8H/On0doWznm4= X-Google-Smtp-Source: ABdhPJz7BeKcKri0w9cEW/YbRF+DkHvbaBkjal5YR23/zRbmYYBZf68lySSGQ4821/W9jLpYfJA4xQ== X-Received: by 2002:a05:600c:3aca:b0:37c:533d:d296 with SMTP id d10-20020a05600c3aca00b0037c533dd296mr3980004wms.147.1645547435905; Tue, 22 Feb 2022 08:30:35 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f7sm46998645wrz.40.2022.02.22.08.30.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:35 -0800 (PST) Message-Id: <0611d16f772597f160bbc32ad9275ddbaec251a0.1645547423.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:22 +0000 Subject: [PATCH v2 13/14] bisect: remove Cogito-related code Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Once upon a time, there was this idea that Git would not actually be a single coherent program, but rather a set of low-level programs that users cobble together via shell scripts, or develop high-level user interfaces for Git, or both. Cogito was such a high-level user interface, incidentally implemented via shell scripts that cobble together Git calls. It did turn out relatively quickly that Git would much rather provide a useful high-level user interface itself. As of April 19th, 2007, Cogito was therefore discontinued (see https://lore.kernel.org/git/20070419124648.GL4489@pasky.or.cz/). Nevertheless, for almost 15 years after that announcement, Git carried special code in `git bisect` to accommodate Cogito. Since it is beyond doubt that there are no more Cogito users, let's remove the last remnant of Cogito-accommodating code. Signed-off-by: Johannes Schindelin --- builtin/bisect.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/builtin/bisect.c b/builtin/bisect.c index 1493d7d1d96..e8a346fa516 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -15,7 +15,6 @@ static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK") static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") -static GIT_PATH_FUNC(git_path_head_name, "head-name") 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") @@ -756,13 +755,6 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a strbuf_addstr(&start_head, oid_to_hex(&head_oid)); } else if (!get_oid(head, &head_oid) && skip_prefix(head, "refs/heads/", &head)) { - /* - * This error message should only be triggered by - * cogito usage, and cogito users should understand - * it relates to cg-seek. - */ - if (!is_empty_or_missing_file(git_path_head_name())) - return error(_("won't bisect on cg-seek'ed tree")); strbuf_addstr(&start_head, head); } else { return error(_("bad HEAD - strange symbolic ref")); From patchwork Tue Feb 22 16:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12755637 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 670BFC433FE for ; Tue, 22 Feb 2022 16:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234072AbiBVQbS (ORCPT ); Tue, 22 Feb 2022 11:31:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234051AbiBVQbH (ORCPT ); Tue, 22 Feb 2022 11:31:07 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A98D167FA3 for ; Tue, 22 Feb 2022 08:30:38 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id p14-20020a05600c1d8e00b0037f881182a8so2361149wms.2 for ; Tue, 22 Feb 2022 08:30:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=ZZyuKkUCfL/8ewV81lWIkbIrT3DSUUuyxciYCR841hA=; b=f8F+XxaOElzFXiULqmvZeIl7q+ib77IZIKYz8z+KPrihqHXOM75H8vukygvw8i/UsH KkvIMTmqtb6XiTwTLKk5mLbaNZ3GWBzjmcaYcF+rSod5d9GiDu+4rATnnyHffIM7xmFd wSamTWCPMM43B5VzIPEuBSYKYiWfSFldMrFTjDHe/miPEoT1bp5/4WL9JRNlLxxdlwdg qhPhGpLRtBYYJ0DEx5oStA/FYnphDjtq3JKkJ51pYYVa8q6yhM7hXP//M6pXxiwva78i NSNtJUKTqVUbvdwk3TAyF85QWhKOvsV39VmJuGNcieG7GZUozBxruVbTeg9wxMWpaAAn 1Zvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=ZZyuKkUCfL/8ewV81lWIkbIrT3DSUUuyxciYCR841hA=; b=sI+xTw+Ag1h57/wnSSXkLXcFQ9GizaDZ6qK2IE7caWFYrldyw1XuaxllLjUypPHlYr 250brt2RhBdC277LDSN/AIhSpjf7TADUiRmP04+3YjNrSzb+bW1kC2LaiwlTwGpVCIm1 9503R3iHNpLxDLqaTsjD8P2+sL26Pp/DgVZmUbXDfm1UPfRJumKf4fFziit9ijrtcdJq 7fmuxXnd6uo64+k8wp2/sTB8YoZmPOJ3XShi6pWdyH+teDpxQXG7LjUXinlfZtf9mRdz bNpbDBTh2oc8FyXVxEgCVBYILtL/3sr+WnqxTBSeW9WykxH/auoJIk36JBuKI42QYdb7 cs4Q== X-Gm-Message-State: AOAM530Lj45t4sknuRdJSrKBoKcY6lnZ4cQ1/Ec/omwuSDN6ek/X/v6M /JHmF2Kb7mIJiLckkGsEc1uVrtYP19Y= X-Google-Smtp-Source: ABdhPJxEfVABhcbb8EkXE7jQIhfe+2TNREx+61hkPaghPZjT/jCTvVsNESAtNkgA0t1IVi9NA85SvA== X-Received: by 2002:a1c:2785:0:b0:37c:773:5d24 with SMTP id n127-20020a1c2785000000b0037c07735d24mr3991281wmn.155.1645547436650; Tue, 22 Feb 2022 08:30:36 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n15-20020a05600c3b8f00b0037bc64fbd17sm2740686wms.11.2022.02.22.08.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 08:30:36 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 22 Feb 2022 16:30:23 +0000 Subject: [PATCH v2 14/14] bisect: no longer try to clean up left-over `.git/head-name` files Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin As per the code comment, the `.git/head-name` files were cleaned up for backwards-compatibility: an old version of `git bisect` could have left them behind. Now, just how old would such a version be? As of 0f497e75f05 (Eliminate confusing "won't bisect on seeked tree" failure, 2008-02-23), `git bisect` does not write that file anymore. Which corresponds to Git v1.5.4.4. Even if the likelihood is non-nil that there might still be users out there who use such an old version to start a bisection, but then decide to continue bisecting with a current Git version, it is highly improbable. So let's remove that code, at long last. Signed-off-by: Johannes Schindelin --- bisect.c | 3 --- t/t6030-bisect-porcelain.sh | 1 - 2 files changed, 4 deletions(-) diff --git a/bisect.c b/bisect.c index 888949fba6b..ebd4287c01c 100644 --- a/bisect.c +++ b/bisect.c @@ -474,7 +474,6 @@ static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") -static GIT_PATH_FUNC(git_path_head_name, "head-name") static void read_bisect_paths(struct strvec *array) { @@ -1172,8 +1171,6 @@ int bisect_clean_state(void) unlink_or_warn(git_path_bisect_run()); unlink_or_warn(git_path_bisect_terms()); unlink_or_warn(git_path_bisect_first_parent()); - /* Cleanup head-name if it got left by an old version of git-bisect */ - unlink_or_warn(git_path_head_name()); /* * Cleanup BISECT_START last to support the --no-checkout option * introduced in the commit 4796e823a. diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 720442de2eb..4f17205c238 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -945,7 +945,6 @@ test_expect_success 'git bisect reset cleans bisection state properly' ' test_path_is_missing ".git/BISECT_LOG" && test_path_is_missing ".git/BISECT_RUN" && test_path_is_missing ".git/BISECT_TERMS" && - test_path_is_missing ".git/head-name" && test_path_is_missing ".git/BISECT_HEAD" && test_path_is_missing ".git/BISECT_START" '