From patchwork Mon Jun 27 18:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896976 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 9984ECCA47E for ; Mon, 27 Jun 2022 18:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240250AbiF0Sgt (ORCPT ); Mon, 27 Jun 2022 14:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239551AbiF0Sg1 (ORCPT ); Mon, 27 Jun 2022 14:36:27 -0400 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 559EF186C4 for ; Mon, 27 Jun 2022 11:31:22 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id q9so14260639wrd.8 for ; Mon, 27 Jun 2022 11:31:22 -0700 (PDT) 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=vJ/hCck+XaBNHDW9f2+pkxNta44cpypydrMCRFEptu8=; b=MYsq9ZwngdCVjtsoRabZkP40n3B1MjbtWrNtGhnowQY+D9ApufCBSqdQAjUs23DYGa uel8pdWNaDSeyhkI7N5/uFPJXxWXHBsg9vPlts5RMQZGy5EF59045NznkFHF7cMi6bpw 8igmhb4URTYH+9iLXPzo2IixU7kyu6/sbnvvrxLoZdwYXtCvCOcIrqkpCFo+E2p4pihA ZUdJ5EKB0l6l3p05jez1DNQLGSRAq/PIRrd0okOo7C1JJLpBS5860/gV2xsWtO3PRb3i B5MX7pmvG902O3ghpp3Ib8iHNpW4Ok10H7kCmeUY99QU6Oc/lcmi1WtFED2poyJM8Y6P KUyg== 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=vJ/hCck+XaBNHDW9f2+pkxNta44cpypydrMCRFEptu8=; b=riUQbMZKM4CzxWHpvMnhxcCkX4waMDJblHwQSXABJFGf78Up8K94zifk8i8CgjHZYP pde71VkTjbJQ+1m6kHH6Oo6t1d9R9hmaq7AmygCmEZrSMM+P/lOyS93X6d4dJ5lFADfg cBYCVvzxhC0baClXfEy2T2G/1veIqNKRic3lPKMQfsb6Ja6giUSddtPDJn81EV6pmuBm w9b+pIvW8wo5Ez7ZHtyQ8NS31bz0rsJAYoFRtcR2ogSIMjMIAmvE1QXWJSreqnBQYB2b qM6JTeqLZ1t2KSfEYmfX9rQNSItNRIINj9DMdJ2VfUNKGjri8BJ66iGMtDe+JXDS6HUr t0Zw== X-Gm-Message-State: AJIora9JOPcTKNHt8mWUxUjeTCby5bzjsm6mExz4m4Qfzx1qcd9dVhm7 zm3Yv122gLquEXjA8fOj/iE4bEs4Lsla6Q== X-Google-Smtp-Source: AGRyM1ttb2Ew8h7+Bk41BamRiTIVFrQNz5ZvBiDeOd62MJ3Fv39ITgu8gK3b8GU/WvQy2zkWWqUkwg== X-Received: by 2002:a05:6000:1144:b0:21b:8ba7:93f0 with SMTP id d4-20020a056000114400b0021b8ba793f0mr13317487wrx.361.1656354680582; Mon, 27 Jun 2022 11:31:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f17-20020a7bcd11000000b0039c811077d3sm13891655wmj.22.2022.06.27.11.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:19 -0700 (PDT) Message-Id: <30ddbd7affc83e9b20ecdd66d941f1acc2cbc787.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:02 +0000 Subject: [PATCH v4 01/16] bisect: verify that a bogus option won't try to start a bisection 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 , Bagas Sanjaya , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We do not want `git bisect --bogus-option` to start a bisection. To verify that, we look for the tell-tale error message `You need to start by "git bisect start"` and fail if it was found. Signed-off-by: Johannes Schindelin --- t/t6030-bisect-porcelain.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 83931d482fb..6d6e72276ae 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -900,6 +900,16 @@ test_expect_success 'bisect start with one term1 and term2' ' git bisect reset ' +test_expect_success 'bogus command does not start bisect' ' + git bisect reset && + test_must_fail git bisect --bisect-terms 1 2 2>out && + ! grep "You need to start" out && + test_must_fail git bisect --bisect-terms 2>out && + ! grep "You need to start" out && + grep "git bisect.*visualize" out && + git bisect reset +' + test_expect_success 'bisect replay with term1 and term2' ' git bisect replay log_to_replay.txt >bisect_result && grep "$HASH2 is the first term1 commit" bisect_result && From patchwork Mon Jun 27 18:31:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896975 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 DB1E7C43334 for ; Mon, 27 Jun 2022 18:36:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240246AbiF0Sgr (ORCPT ); Mon, 27 Jun 2022 14:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240190AbiF0Sg1 (ORCPT ); Mon, 27 Jun 2022 14:36:27 -0400 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 80CCA186D7 for ; Mon, 27 Jun 2022 11:31:23 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id bi22-20020a05600c3d9600b003a04de22ab6so1245997wmb.1 for ; Mon, 27 Jun 2022 11:31:23 -0700 (PDT) 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=tlgMODRSTxfugpA6U9GDTkON3GDMxqv3+xIrbLK/Kg0=; b=VMhRXtyEDCJs4WTGeUSXW3ziSax1FpG7DHNVgVHlgPEeOOj+HmZKaMcJhIINchgOD0 4kDVZbq48sk3F946ePA2FFUXx+gi4foCBC8i9Xuu6IRL5snQIs5ZLlyIv+wokvzp1eoi YAnzNqaFuSrbqyXAI0AkF6k/vJAd4WHj1aMu2QjVLe6aT6K1eV8C6kU8JiF1Ed6XO6uc anJs/0pCZUz8WbiLvfRey84flIc0QIHiin9Q6d8rfDNW9ntGvZR6Byuq4SY/MFi//Y3r wKNlawx2zbSBrICA5T/1LImextB0ugDYTvKA8TJYug1P76Zp0cOF+izt0NvFMvwngQL/ kLnA== 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=tlgMODRSTxfugpA6U9GDTkON3GDMxqv3+xIrbLK/Kg0=; b=1lsjXwhYZ1gNXaBCTOyiV17BM06uZ/3eIpK7w9jmJf4vX0H2efRe29psbTGBHIlBiY H3yfnW0YjF4sxHqmDdzmpgXZub7s/DXtT64AT+4KOMRUwxl9FY8F5jb+ycMc/huSmlCn Wl7F/9xZPmiYzimCNjMTDn/oWTnoUuGYzZlKeR/1nRJVHG/oSjQQIJNjRn0MODsCbKj0 lIunmm7XrVTIKJRunPrTkLVH0SVYBRlG4Nbt206o1YpJGvYP9TBp7eLl3NvWNliSXWl5 aNlqdKa/bB9qTFY24uLGtu91ByFcKFFmHUf4ESFEeQ0nIHnvh/37enY9dCMQcJp7OYJm +11g== X-Gm-Message-State: AJIora9OLa8aqBYFIe8qd7simfQIxgi2wuvtYJ2jfVNswobIoiKS+BpF RbVPeUIXbs8kxUEo9C0FPgd+DI4RZGCP6g== X-Google-Smtp-Source: AGRyM1sSz7YzNLae9TFeCYcC86JII801a0SxFKUahfxpgCsXgiAqdjOsrWaC1WW1c1H9ZZ8bmpzRzQ== X-Received: by 2002:a05:600c:4e02:b0:3a0:4f36:6c0b with SMTP id b2-20020a05600c4e0200b003a04f366c0bmr2146623wmq.54.1656354681792; Mon, 27 Jun 2022 11:31:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p2-20020adfce02000000b0021b944c9ce4sm11282402wrn.15.2022.06.27.11.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:21 -0700 (PDT) Message-Id: <97dd2da8f89fb918a49d4f70d8dcdad9652e5143.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:03 +0000 Subject: [PATCH v4 02/16] 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 , Bagas Sanjaya , 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 | 2 +- t/t6030-bisect-porcelain.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 8a052c7111f..cc38a009bdd 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1263,7 +1263,7 @@ 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" + error(_("bisect run failed: 'git bisect" " %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 6d6e72276ae..7a76f204083 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -1063,4 +1063,14 @@ test_expect_success 'bisect state output with bad commit' ' grep -F "waiting for good commit(s), bad commit known" output ' +test_expect_success 'verify correct error message' ' + 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 Mon Jun 27 18:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896979 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 BA990C433EF for ; Mon, 27 Jun 2022 18:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240263AbiF0Sgy (ORCPT ); Mon, 27 Jun 2022 14:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239604AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 AEB1D186DB for ; Mon, 27 Jun 2022 11:31:24 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id s1so14247123wra.9 for ; Mon, 27 Jun 2022 11:31:24 -0700 (PDT) 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=N6bHGRGDaDqRNIxEMtB8llvdLvD5v5KCgVYAs2psvhI=; b=OVxKD6Dm5jfr0Tbp5Ax7x3GBsOp9UlztpP6no4qdt6bk0cCGlkyFmeSHlOo0oyz2PS AMOn/H2M1yjRpe5C0jQxDgCaXxSNjug0I4Llb1JlV2Oa8r/qcSLwRQQtBQ0soYicSlpf dfF5PtfCMozGAxUzOTlf7kiaLH//uqrGJkA/8Qw1HEK0nFej3M0paHebWp+4YqHhTuEN mHb8h/B6qJyFM+5Y1UQVQPzmGGvfaAjmLGH8MfAX2dNB2p7pkzvKum/kwkKoA507xSsS lgNDe7E1FDy2f9ZXZxE/SP9huwUWT/EoenEFiVuqQ8yds8REud3EzWO1XCOdjKTOOtX/ AxOg== 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=N6bHGRGDaDqRNIxEMtB8llvdLvD5v5KCgVYAs2psvhI=; b=heBSLIxPEHk1BMzprvshoF/jRxmnf4cJjs5YeB16SZEQ5EDByr+Kzx91prtOVOUAeR 5PLKi0x9tCUeaUD/RZDVeteNT/QvKnphrh9favtoftDDZNCkya3i17Z6ht9CdzBWDsk7 oCYZjBrk2259rk8buVIMZGTyRuV0CPMztY8RHk8cMknp29KwoUp3jB/OhtCpyf/KuY2R Hi+koMamgiPQGPteDHfy1kJHuYx52QM8VoWO8Hq4y99Bi19/FEdwnQ/m7fviUPFgWTWX hv47HSNidS5jj3Z6rwSmIQPQj9158ZYFW2QksFInnCv8LkuWsxQCyzJURyl4F7kpkYhi S5mg== X-Gm-Message-State: AJIora9pUpleLPjcaJSLziPsOrXt0FHsXBlTlhFdooixStJW2dp6sFgV CBp/tY9JK8bLgUTpRSo2oyaqsbyzVqpdNA== X-Google-Smtp-Source: AGRyM1sKF+whTZhI4KHVhyfOo0YuPy/UzRShWvMrln3aOQcl3hT42vDdLR51W6ZjmZ1MPJsuHE02CQ== X-Received: by 2002:a05:6000:1acd:b0:21d:1079:e94 with SMTP id i13-20020a0560001acd00b0021d10790e94mr4079541wry.122.1656354682881; Mon, 27 Jun 2022 11:31:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h13-20020adff4cd000000b002103aebe8absm11142808wrp.93.2022.06.27.11.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:22 -0700 (PDT) Message-Id: <5571e0f76ffd531986bf6c03b99bb34d00815fc3.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:04 +0000 Subject: [PATCH v4 03/16] 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 , Bagas Sanjaya , 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 cc38a009bdd..2345c9f773e 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1223,7 +1223,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); break; } From patchwork Mon Jun 27 18:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896977 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 523BFC433EF for ; Mon, 27 Jun 2022 18:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240254AbiF0Sgu (ORCPT ); Mon, 27 Jun 2022 14:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240194AbiF0Sg2 (ORCPT ); Mon, 27 Jun 2022 14:36:28 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE28F186DD for ; Mon, 27 Jun 2022 11:31:25 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id o4so10314522wrh.3 for ; Mon, 27 Jun 2022 11:31:25 -0700 (PDT) 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=003autOeS1xarsExmzbXFgnmDohyRCBEa/jqh+zG+G0=; b=jcIrbgNxh8nhD1MUpiL20plY0ReAIHyzrjtViEcx2PcVNSCTdDlpUlQflqrhoJMHsc t32SxDeeDhc3j8KCJPJzcy6yYYEeWln+1rPwN1KcZqzqg0KzWK3iQ6sWtF5ANzakqpsU BFQvbMDICFSrl0TLD64KVwhVHMRqDGyrRfg+tbqxCci4XI/0WX7+QJ2z7hcVJpirZBmX CFeUwO0/v8qX2sc6wAPV1gNAleXZd7td7w4dZYZdjKt6A4QnnYQZ0Fhc4zPjDbZyyf3d e4C0du+Pz9qgSGYwsEGa+yCoSgQUmBUXFV1l/DxIvNpEmyFG2o0uOHshlcfrFJ6k+x0G v9aw== 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=003autOeS1xarsExmzbXFgnmDohyRCBEa/jqh+zG+G0=; b=KSaNnVX9pxJhsJKQ8e7e/hGWQ/dlMhP/nsXDcsffyX8Nthi792Dt2azNbs3CbfNnul 1xjweyg78DWDA13HzJkgQqHS7gGtJk+OpGmHh03eOqsZtxUOD41paZnjZqDgvFfPSnY/ 7BAA0pCzDzQtLnp9zgFjJX+XHZKOPyaTvH2OlS9VO/uN7VhYX7sazbzO+Z8MOK151HwZ IeSOqg7APKSF3N3mh4zizLMbJD1ChXfMWtZ7iwoyBcSPyWRDNkL9nqTCXzpUnEbpdK8S /whEjT7RnCtkEVIeePpzCwPJZmKt08+Zy0xYzf75ezobKAORgTNqpAmt4EvisSE8Tm9M 3giQ== X-Gm-Message-State: AJIora8rI9hfASptLTMJTR+15AjcnW8yeCjT5veNpyhI/Sa/V2jPL3kU shJka92BUV2txwsqvYwOZGcnYUguHkY8hQ== X-Google-Smtp-Source: AGRyM1sXfI40xYdSvtDPVORZX05p4lSXeyAf3WOY3w7IUQg0Pu1vJJOvEZACtLMZ5z7qdqNBmyt0mA== X-Received: by 2002:a5d:6ac4:0:b0:21a:3cc5:295 with SMTP id u4-20020a5d6ac4000000b0021a3cc50295mr13319368wrw.630.1656354684216; Mon, 27 Jun 2022 11:31:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n14-20020a05600c500e00b003a03564a005sm16171285wmr.10.2022.06.27.11.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:23 -0700 (PDT) Message-Id: <5bfaf0334c32a5cf71c19c72c7ca65253d460607.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:05 +0000 Subject: [PATCH v4 04/16] 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 , Bagas Sanjaya , 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 2345c9f773e..8cfe3926dc7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1292,7 +1292,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), @@ -1316,8 +1316,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 Mon Jun 27 18:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896978 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 31055C43334 for ; Mon, 27 Jun 2022 18:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240259AbiF0Sgw (ORCPT ); Mon, 27 Jun 2022 14:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240200AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 F1B96186E1 for ; Mon, 27 Jun 2022 11:31:26 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id v65-20020a1cac44000000b003a03c76fa38so5379463wme.5 for ; Mon, 27 Jun 2022 11:31:26 -0700 (PDT) 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=myo5tcMb8Xf5bZFQBptagcWIswi5SasbgaGUzlTnphY=; b=Pkx9NGOLMMbNBxQoLbAMkNOOx5KrzEO6hqNES8aisMn9SaOMLxA5WtOArU4k/Ra5u5 H2cfTY0vK9uAVD2JXKzyo03Hw1ntk7U8kS8AiwwksgBSt6R+xRwHNJS4vSWSfXgfdu6+ Y0h3Bpf0EQgJOLTR52Yq3qpx9kfPw9K57h1qFHKk93pZAMU3JR4yg9h7rjpi/M8AOVRh VLyN2qBwIRDZNYZHNojVY3i33jX5CNVA59UwyldWXfcDGhnJ1c9lmo8oLxsxMYO2NAIB 7+NOwYkkwWGwW2ON1wiuYo82Kce/b3NsvkGTtdCUdx99BaY7IC3yfVdGxhl5GUA1Hn7f Ewsg== 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=myo5tcMb8Xf5bZFQBptagcWIswi5SasbgaGUzlTnphY=; b=M7nzVq0hpMrY50DRbueKc9VwDH1XIQPlChNa6lJVeeWXwUPf9lwEBQ/lMFbLeqIuOQ l48aW9G81OGUU2XCoeKh8bO5sUUu5FsRKzKswPheiTWFU3kSgi1PmzoOWyyQRTvF2Sz/ fVUIoL7JSpzwkUPXJcbqTaDWybGL3pzD41R/u+5SBLioKI48erlljR5RqKWljyfxkVia q/Mn0GtjtV7O8qVH5bTBqDZeDCRh0/SzPdsIjrlOqDTdc0JtAW6lSKXl11NXA0DxdCmq BABo60SfgtXoncsMVJ3ATFV69pzVOWLEgxKrB9wwLblmt6AnbpwluwtrA5RouRuZAEx0 If6Q== X-Gm-Message-State: AJIora/Knoyy2Kk5ZXo6JRZUsCnDlp0A304+8v9Ir3e/aRQthwBqkz2t FkVBmN6pWTDMednxoHnQ/xPk4R1C9+0+RA== X-Google-Smtp-Source: AGRyM1vEt33lKd+ebiHpefQKMF1UFfsoKKykgkqaZMvdmeS4YUW6tAzUN4mSpBWqGcfJNSafBpdQLQ== X-Received: by 2002:a05:600c:34d0:b0:3a0:2c07:73ac with SMTP id d16-20020a05600c34d000b003a02c0773acmr22181346wmq.85.1656354685267; Mon, 27 Jun 2022 11:31:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w9-20020a5d6089000000b0020e5b4ebaecsm11218882wrt.4.2022.06.27.11.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:24 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:06 +0000 Subject: [PATCH v4 05/16] 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 , Bagas Sanjaya , 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 8cfe3926dc7..75d008d7fa8 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1280,7 +1280,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, @@ -1296,8 +1295,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 Mon Jun 27 18:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896981 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 0757AC43334 for ; Mon, 27 Jun 2022 18:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240279AbiF0Sg6 (ORCPT ); Mon, 27 Jun 2022 14:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240202AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 377F9186F4 for ; Mon, 27 Jun 2022 11:31:28 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id o16so14288628wra.4 for ; Mon, 27 Jun 2022 11:31:28 -0700 (PDT) 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=oQg7hS7LlJt/v3EtqBKXz/U9lqK+1s0M2CiZKor15J4=; b=G9K02qftiANFqWnNAfhdQm/GGxed+xXZ1l4h7pvMwsYnKbaxfhUOyXjsegZuekrZ2U ivkFWb0Hryu3E0VqduZBJuLJa+XX/GisJpY4yu4INgdZP8IbTFYrAJwVnLNV+RBkJrn6 PvbGPFPGV+5a6cYGabaQoAZXx0+9Gjbg2ipn5r6V60zHnNfWAHcYRNtabKD7W9AQFjTz i/nR4fANshsNoj3wQtB02YJ7SMwMDAIG5lj2w4ce+IF6xVVsIAryJckaKk3pQ2mu90Qb RpknA6XgGsrHj6/Tv/ZRTWPlGrGnLUJrQx5RoflFjNajYyNE6jxXmFaxM4wDwH4zKyp9 ZbmA== 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=oQg7hS7LlJt/v3EtqBKXz/U9lqK+1s0M2CiZKor15J4=; b=K6ZScvmr3nCqXBe7b/YRop81bfvduArukiIZsITPd4Slf5RrRLVjVHj/8mZS6jsVkR zpyJP0UvmQnCwApvcOCthHithgTS/bHvWVfEr4AyGi4NRKs4qo4YfSPQKiTX2XZ6oabE SPYXqqfADTU7btXh51AWFBYGtuNtyXAWhxp61+P6HjebCoabnTQduw37bYO8ER7pBtBp W2BU4WU9e9L+dcsLzQ4IG8QDnuY/ztR0A08TBfHaYzYfv9O1CmuKTvPLXv/kzcg96Qdi n9elwI6v/sgML1txbS+a9bxhmdcekW0Ei6wYTRlw+VPoSS9tLW1FzsJIiGIHSwR0HstN KWqQ== X-Gm-Message-State: AJIora/aKGV5Bcz+rk6x1LlHwb9Wtpq4brHGHBQ0Ycd8EHu8E08Fubq2 /G0CRLGKAZzPJk/SSU2Bl+C0U7qSVrYClg== X-Google-Smtp-Source: AGRyM1v+X/yoLDJ72BlV2uTbar60nFA5HJUCIjBLmOsUKXtctY0/RqC6V61WGDGg2QNfhE3+tendTA== X-Received: by 2002:a5d:6c64:0:b0:219:ea71:306f with SMTP id r4-20020a5d6c64000000b00219ea71306fmr13190980wrz.223.1656354686311; Mon, 27 Jun 2022 11:31:26 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g20-20020a1c4e14000000b003a02de5de80sm18198593wmh.4.2022.06.27.11.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:25 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:07 +0000 Subject: [PATCH v4 06/16] 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 , Bagas Sanjaya , 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 75d008d7fa8..477aba811f0 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1282,7 +1282,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 Mon Jun 27 18:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896980 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 CFCF2C43334 for ; Mon, 27 Jun 2022 18:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240267AbiF0Sg4 (ORCPT ); Mon, 27 Jun 2022 14:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240249AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34D41186F2 for ; Mon, 27 Jun 2022 11:31:28 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id o4so10314522wrh.3 for ; Mon, 27 Jun 2022 11:31:28 -0700 (PDT) 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=cvAsonS42Tup4hwd7c6iXHefk5sNs59iVXAPJs+zYh8=; b=Or/iiq7W+XU44jDvGusWotTmY2/eYzLuGMWrPeeJAqhAFFsUELAfChO143EVz1x3yH OaPWB+EEWNpMf0065WlrSRGuzfy7/zvKAtj85+TFaPWfAlrHr0XfqbGQkTWD4DKLOtyN rEi7mrMPLOrrzhc/SO1xyAqgNRu+KnbVHvX6xtqVdZPuTVYmTxrUSb+1gOcOxRLkEm01 lG+4+pWhCHDG1gSW05DzD9uBA9bkVH8knJOKEPJBjT0Ka4FTnvo40XuvdIeEal01Sevo 9So0uXdZgaAcS2NQiPbHbdIrRFgYh/Hum+p6B7G+S511kcs67dOiyvFtOJhRoJhs3fIW a0PA== 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=cvAsonS42Tup4hwd7c6iXHefk5sNs59iVXAPJs+zYh8=; b=bcrE+7Dhq24lt/M9HgPI/CZX+7YnWnz54/iBju+vo+GD0mUDoga0c5xi+H6Y4z+KSk hiKJKOef5jXYYZfkni1S3jFOzgSF9tVbDt1K5GD5gbMlLt4a6wbmkExaUiVeKM96wxbz kdzgmVT7yyPEO2A2s5LKu/rZyTNy6Fra8DgaOs/CDFze4eEYBX2VqV6IqSdEfRF0ZyZ7 oLH0Q0oL1FOAbA2Lod3UJQ2Swh39LxnVYZ/RfGti8sQh8IEWGhwVBmOL2MeCJB9PlP2o chtCkSRtQfgA7BZH6VClyQ5ot3QjZAunq1QgS+flDUGUbg3d1aU98Ue47o+rJTTVMHMm gPeQ== X-Gm-Message-State: AJIora/k/gfXnLgazhamU/ZM7UdZNYHGvy7S9l5DDGTNmkuo+ghVb5ib HexaxRdFxqBOL976VKcIiZBX4nV/S7E+Ow== X-Google-Smtp-Source: AGRyM1vfuKBgjTq2BSbE3HZqRawzJqShpFFC3hocfHFbUAiUjx65r2g0q54gtpJufWAJHWVj6lTmvw== X-Received: by 2002:a5d:64ad:0:b0:21b:a83a:e5ce with SMTP id m13-20020a5d64ad000000b0021ba83ae5cemr13429276wrp.701.1656354687506; Mon, 27 Jun 2022 11:31:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k8-20020a05600c1c8800b003a04722d745sm7169041wms.23.2022.06.27.11.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:27 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:08 +0000 Subject: [PATCH v4 07/16] 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 , Bagas Sanjaya , 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 477aba811f0..45983a0a1fc 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -900,7 +900,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 Mon Jun 27 18:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12896982 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 F1567C43334 for ; Mon, 27 Jun 2022 18:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240281AbiF0ShB (ORCPT ); Mon, 27 Jun 2022 14:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240252AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 4C44818B15 for ; Mon, 27 Jun 2022 11:31:30 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id w17so14261751wrg.7 for ; Mon, 27 Jun 2022 11:31:30 -0700 (PDT) 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=kZA8sVf6KwZqKRPx5rlUz8DQlOu5VHM8cteZKnFwQ0Y=; b=YksWLtQrKzj4EDoVFJeb/TxkaeQLEHVz9q3fAuNU9PrvZ/VNPl0rJHtAd37QcQtOb2 IJina7rwrc/IEaXBqV/L8RBFUpUGgkfpMS0OB337eyg49EHY3LMwM9O0kK83rc2RSzgK BOB5KoBFmwIwtJzohGyVOVuw+sMkEe97mmdNbcnsjL3PMRfA+5vBEsDFMr5Ry8wHspu7 yqXcwGmuuTMXsyxQbzuzGiWJbWoLzqEkLhZZiACi9cGkEEoi1TiHj7qVN9icfEynyQOD +bBYG74oZai6sZSVdGv06AOKQpVqWqlwi+LLpC+CQR5wYA4oIqP05ss6npyCCWh+FuKC tDuQ== 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=kZA8sVf6KwZqKRPx5rlUz8DQlOu5VHM8cteZKnFwQ0Y=; b=JIk+Y3L655pNj6WcOAyEnmfysc53vzrZXKhFAqKTOfIv0QqfFbdBsIw8NyrlIKnBg+ VbjSlyhSys+BAyVzAnnSM3MR+DivCv4ofZXgJ9KsEIPlCaFNhcXP1cNIsmo7gwKW01iY 9343ZxNsNrQZ3XHETVuPokn9P7OfmtTPqcfY3+0JGzqPGpy5MAxo1oyPmBvOU71fvdJb jqX9ayx796eWg1gK7h1M8cniR8dgYRW6NRt61funu0bAP0zEF02qXqSXoegYp9KUM4F7 Bthq+8hV6QedDgXTwcZuoZ9d4D4UVXAlSSimP5dkAuZCoeHrXihdqlvkInPgQayqLy7w ynjw== X-Gm-Message-State: AJIora9clxX4QanVBRZFmEAlh9oCtD3eMPkf7R4TMxOA7DtQYSUQ/I8a p3WQLm5iVN2pUzx1QvlE71zRqEDKHDufHA== X-Google-Smtp-Source: AGRyM1uk+Pa+ThJ31VZOC7Hub3eVK+Q+sVhFj+Dh/soJ6EuXfIC1olxzVxUzqA1epf8oOGYXJy/zow== X-Received: by 2002:a5d:598e:0:b0:218:531a:eb5 with SMTP id n14-20020a5d598e000000b00218531a0eb5mr14022340wri.334.1656354688550; Mon, 27 Jun 2022 11:31:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z17-20020a5d6551000000b0021b932de5d6sm11307567wrv.39.2022.06.27.11.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:28 -0700 (PDT) Message-Id: <375a46dca9f82c91c8dcb873a5ca95b5fc11f79e.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:09 +0000 Subject: [PATCH v4 08/16] 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 , Bagas Sanjaya , 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 45983a0a1fc..2d6eafa2abd 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1279,37 +1279,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() @@ -1324,19 +1324,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) @@ -1344,15 +1349,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) @@ -1360,14 +1364,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 Mon Jun 27 18:31: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: 12896983 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 DAEE5C433EF for ; Mon, 27 Jun 2022 18:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240287AbiF0ShC (ORCPT ); Mon, 27 Jun 2022 14:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239253AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55F8A18B19 for ; Mon, 27 Jun 2022 11:31:31 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id o16-20020a05600c379000b003a02eaea815so5268784wmr.0 for ; Mon, 27 Jun 2022 11:31:31 -0700 (PDT) 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=D2Vna/oS9akoKBeXrPS7KPJyOGAnVW9RU62lI+f6aWU=; b=dp8UQApIEv8OKTu21EvZZE9Rm4AuPombwfj6HYBx/Sn5Y7JzB67oPrzhrjt3TSkOd2 20CKf4iYxulRB2+e2LnlBQ+sHXQfYmscUMKArq70GipWtLz63sh/HvwkdKtNiMPqTdYg GpxTolCi0uFDbhnu1v0SxSOoQhoTh+8RIHqW5iuuOzJjHT0nOpJ9ebt6K4VroFDNXYTg iLW/VwZQ3A3NDTGztfFVL2Zxb7VEUJHZn/ZkDrK0czj3zKBtgiMHHm2EqlqJedepewzL 0+8+FqBoGM61PHUFDxfz7YW2ju368eEHifG1VQMRIRfwaRT0bIqrA/t/MgfHR6+Ba+Gh IB8Q== 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=D2Vna/oS9akoKBeXrPS7KPJyOGAnVW9RU62lI+f6aWU=; b=E6vSKtypoL/ZZDT+3AFWeW85bc9wE++SqGMmgGmbzsx/tF2Ny3sXXmrB4GQv2v2kiG shY6opt+ElFIvWdwh1E4Ra+qjEMIQVU1Y4zXuao3mtL+EGCaB3AhO8ETktLc2IRKzmcU rD7qZOMM9u43rTx8NrVe4vkMxqB3QwuS1akDxhmnCrPxGnwXzrvpfVhfUUO4FojL+E7J nn0I4vwqGh/io2g0n/XHP+4fG9tC3X1v0Yo4lVLrnxSkCNsiek3+8E89wMH/jV1ESIE9 RcIMbfpj08RVNqxorP2r/uZ8wWo8+w5zJK4Gpo3E+JBeWSYQCfqjJ3ywH2KCGXMdT1DV xdOQ== X-Gm-Message-State: AJIora/7qxraHmcaS/Z6hb+uO5lHehA5CpVOPzizYIVJWRW3weWbGlUJ YxSGn6E/ilwyk52K4WzUh1BAh9Zx2bD6jg== X-Google-Smtp-Source: AGRyM1sVU50wcH2uOcao+LJnrLg+Jb++A7L/cJOlMAo9nhigjD9IyFzNyVKnjmNrdgXhTItMzCFYwQ== X-Received: by 2002:a05:600c:3489:b0:39d:b58f:6797 with SMTP id a9-20020a05600c348900b0039db58f6797mr16642010wmq.205.1656354689562; Mon, 27 Jun 2022 11:31:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 3-20020a05600c230300b003973c54bd69sm18335364wmo.1.2022.06.27.11.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:29 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:10 +0000 Subject: [PATCH v4 09/16] 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 , Bagas Sanjaya , 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 2d6eafa2abd..1b1ce0941ff 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] [ [...]] [--] [...]"), "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 [(|)...]"), "git bisect--helper --bisect-visualize", @@ -1320,10 +1320,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); @@ -1331,6 +1328,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 Mon Jun 27 18:31: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: 12896984 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 09B70C43334 for ; Mon, 27 Jun 2022 18:37:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240291AbiF0ShD (ORCPT ); Mon, 27 Jun 2022 14:37:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239634AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 B19E218B1A for ; Mon, 27 Jun 2022 11:31:32 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id s1so14247123wra.9 for ; Mon, 27 Jun 2022 11:31:32 -0700 (PDT) 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=9Y31p35ezdfjp7sTmTKzK5uLAuyh+W/Q9177MXY5dsc=; b=TpsX6emPUzA0zeti/w/EIMkytGuFZAxS0wY+Oi3ZUgaUVf71pQVCCbWosvjzO5f0je d8ycZ02wqTlR9bXqXx/7+L3ec35K2g3nh5jlofVpU3GGhT4Y7jh2oUvMAnsBmGMHWgOx AvOm/C9HP2+GZSk9VMWtnL9oCI4LDqEwNZjacj40GeTRW2Y4zmUbWp/XJG2OrRGECSRr K7mL+2lAQ8MMS+vR2f7sOKsxHs/wfx6K+Ck9pNki5q4ayoc1wuN7BK5M8atRSEGQIBG+ Xn+6BgK98vBk4gQcOzQtelAm/PYf9cIMmw9tgXxN63fcU5i5wbcxWeg/FI2zYOSAZOl2 xVGQ== 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=9Y31p35ezdfjp7sTmTKzK5uLAuyh+W/Q9177MXY5dsc=; b=ms7bajY8DNR4n9kwMmc/fG7T9IyAwSHZBkbhD95jeoxzNS7P4RWe0OTcPNleVpOnyU pp9XkwXIpOw+EgKJwpV9D2iYJ5vME37+ZByCqjUGvPjUSpthn2w5BXhwI3IjUp+H8Fzn SijFuvhzAI+ILIOByocXPYT02i/wUiXFzTf/ymZ1WJSNTJWhls2lRpc8du7ir0Ymwst4 q8IKtaRQrSzmXmN/6uutC7kX9DXLBH3mn5XM4s8KJ/kdTL24klU7qReugWlAd0V7MM9j /hkC7TdqLsPDd+WfZT6KrdCXreLpVUBJePI/sUHYHg/cjiv05hHf4bd+YTT+S41V2jT2 TOnQ== X-Gm-Message-State: AJIora+2rOrrorkHl7ppdT2vd8ECpfE2GQ4ICrlUbmB/XPG5OxCiQfNN ChgxhnZ/R+JpZHpIPeLucHCu9IfXjmC3Vw== X-Google-Smtp-Source: AGRyM1uh/fBOo1nWSdYal95fV8VAj2KoJtenRHk2XomThGEnSQvahtCKOSFZdelpP2FWi1M319nB2A== X-Received: by 2002:a05:6000:901:b0:21a:a576:23cc with SMTP id bz1-20020a056000090100b0021aa57623ccmr13424168wrb.489.1656354692031; Mon, 27 Jun 2022 11:31:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s2-20020adfea82000000b0021b90d7b2c9sm11188563wrm.24.2022.06.27.11.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:30 -0700 (PDT) Message-Id: <87f53469a721cefe1dbfb9f1b7906f189ddf3632.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:11 +0000 Subject: [PATCH v4 10/16] 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 , Bagas Sanjaya , 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 1b1ce0941ff..22099b9ebe2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1325,16 +1325,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")); @@ -1377,6 +1367,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 Mon Jun 27 18:31: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: 12896985 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 41702C433EF for ; Mon, 27 Jun 2022 18:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240298AbiF0ShE (ORCPT ); Mon, 27 Jun 2022 14:37:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbiF0Sg3 (ORCPT ); Mon, 27 Jun 2022 14:36:29 -0400 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 BD68C18B1C for ; Mon, 27 Jun 2022 11:31:34 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id k22so14269649wrd.6 for ; Mon, 27 Jun 2022 11:31:34 -0700 (PDT) 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=8MAL6kv4INxPRvKLx6NLKMqEw4XIEcWrotDyLEp0s8c=; b=TG6FnHdttTWoA9jXwXVy75YoIfcSt8Yp9lMlj40LQTG858Uv3JCp/HGkvbySm0gNFG gKEdtq5HKDRDvqP2VnmUZ9lQhFaVY14JWb8WCMl04+dixbUMPmFZILHcIs7D6la2xj6R Gmkjw4YNMyZisnGIIWnTtWf3rysurEd7gihFuzbFSstftofhisnhFDuSzk3H04eusBf4 025InuOgGzNFxmZTC8E16eZAtjVv7jQsQOdzAaEpS1nANqmkXpsEcUdx5LfHAjkZO5KQ 4huPlSDPW6I8FzNVuVZQMkvoZ/9AjNblVdb35heHLQnkQMNffxQ6tmoPbU+K4+r1henT K78g== 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=8MAL6kv4INxPRvKLx6NLKMqEw4XIEcWrotDyLEp0s8c=; b=kXUQTV4qhbnrmW5xVk7xER4/eNdgHDpHTK5S03pwN0FqOFuPTN0/CAF5lipOaKFuPq GR61L6UKatZgfGaeu5TAr13Cxdi7N4u6qh8lm3HaIq+W+OFivKJ+zsLosSwgGrX+CWox bij1xJjnmz+8HC0RbW8yyA7++uFzDT21BLgMlYgfoM1TZRu81yiwIwfTxZXkkFUnjLvY qwtb7zqqhWlEQmHhg6COBp5jCFnTPdT5m3wHG7wNe7evsxU6MnC/utmGd5NiVqbVH2cH iCUibDx7excW570Zha3NP/jJb6DVwtypmVFi7hLILPXU3w8/nYZA/iX+W7H0Xr2SzxjH Hxdg== X-Gm-Message-State: AJIora8UYVSSPLn37sBniiEkDFhFSUoUKVBDyO1+//IxFJaa1gL/Bo2C olW03vzDsTDOw70bNZdQCAGB0JGPoEB2kw== X-Google-Smtp-Source: AGRyM1uaEwoXaYraY9iMQwmAxrCBbtq5BLPHmPRsKLiZX8jIapEmNNBKAZiXdbO1mfDLgU0pbYF3vw== X-Received: by 2002:adf:d1ea:0:b0:21b:a6cb:fcf6 with SMTP id g10-20020adfd1ea000000b0021ba6cbfcf6mr13522253wrd.477.1656354692987; Mon, 27 Jun 2022 11:31:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l8-20020a7bc448000000b003a0332760c0sm13967688wmi.16.2022.06.27.11.31.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:32 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:12 +0000 Subject: [PATCH v4 11/16] 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 , Bagas Sanjaya , 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 22099b9ebe2..86195058cd5 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1327,7 +1327,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: @@ -1337,13 +1337,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: @@ -1352,18 +1352,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 Mon Jun 27 18:31: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: 12896986 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 2CD92C433EF for ; Mon, 27 Jun 2022 18:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240314AbiF0ShH (ORCPT ); Mon, 27 Jun 2022 14:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235241AbiF0Sga (ORCPT ); Mon, 27 Jun 2022 14:36:30 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0150718B20 for ; Mon, 27 Jun 2022 11:31:35 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id o16-20020a05600c379000b003a02eaea815so5268784wmr.0 for ; Mon, 27 Jun 2022 11:31:34 -0700 (PDT) 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=42iKZzegnZlyfRqzAvQLpJaOWagryEx/SDmBBXR5+zw=; b=ppzA7ieLioj5qxpWx5ZGSPApM9bMgXcwZ6JjpIDVeJWu3iFOKuk/UBVrOxreZGlha+ ifthmBTrv1i3GspOWeyGRnKJPVmjQkxpPVVximAIzAEAJtB6JmrkkNRxJ5NZs/lthFa9 kfO4MGZ+4qgagg64kQbhfYxEn6+FuC8LhXeh6weS1DOQ2Kmo7YX2ddkEu8OWW11SHUUd mlHPRkJkiZuxVxR3sPQlmGm3ueCKCxRsTckEVfAB4z7qbWxa/VlA7W0grvsZKsO7KOw7 01w1TuNIb5/ULV8qUs98TuHH99934GyFmCRwcIpRqooOl32eePaXKatCBkg1Ay/bSbwE SpWQ== 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=42iKZzegnZlyfRqzAvQLpJaOWagryEx/SDmBBXR5+zw=; b=WeRGr3OaGGWgvSibN3iO3O5g0tfuKpvnr+YVKcBx+q2ei3Xa2MXlypKx3sSX1YejoO 18dkeb6FnPH3mx0bnWefdC2QAbVcHliHE92DmjyKSr8LUhK5lQyxFFNCCsVYeDWfhPOS BJCs5NRBhyEOlb9/nQtEWwJq3zyQ+WlohDNLgbXylc1lvoBLAB5w2XQ1QpmvDzxqvZbJ pGRA7VGspIkutNUgLlhXFMCBGKKwf+467kjoTTmgrFk3G7iSVYu4KEMTQaafI0UosUmp aOI1Gt9kQ7fW1lcoUAdI8TElkK5HDbZU3vAqP/QcyWSg+OB5d3xDG925Odg7293IaZiU za2g== X-Gm-Message-State: AJIora9yPjWiyBYJAqNELb0yjF6R9kvaq6/AThySpIssxbx6RLbe1bQh o4QKKUHNFW1dDeFBgvIV2Y2+t5HqkzyNIA== X-Google-Smtp-Source: AGRyM1uULTy+QYCyfYk3PYM7Zke0sF0blRKZ16n6jWUh1S9trih6eyYgolS2vZIY9bBOjzoDIRB5qw== X-Received: by 2002:a1c:19c4:0:b0:3a0:2d2d:93e0 with SMTP id 187-20020a1c19c4000000b003a02d2d93e0mr22042495wmz.117.1656354694219; Mon, 27 Jun 2022 11:31:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w13-20020a5d680d000000b0021b93a483dbsm11215969wru.32.2022.06.27.11.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:33 -0700 (PDT) Message-Id: <5dbe233e4ec2f404bb236a8ee71d24e8cb6a4387.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:13 +0000 Subject: [PATCH v4 12/16] bisect: teach the `bisect--helper` command to show the correct usage strings 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 , Bagas Sanjaya , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In preparation for `bisect--helper` graduating to become the actual `bisect` command, we hereby teach it to print the very same usage strings as the scripted `git-bisect.sh` does. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 65 +++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 86195058cd5..1914aa7c69f 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1,6 +1,5 @@ #include "builtin.h" #include "cache.h" -#include "parse-options.h" #include "bisect.h" #include "refs.h" #include "dir.h" @@ -20,18 +19,46 @@ 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 ..."), +static const char *bisect_usage = + N_("git bisect [help|start|bad|good|new|old|terms|skip|next|reset|" + "visualize|view|replay|log|run]"); + +static const char * const bisect_long_usage[] = { + N_("git bisect [help|start|bad|good|new|old|terms|skip|next|reset|" + "visualize|view|replay|log|run]\n" + "\n" + "git bisect help\n" + "\tprint this long help message.\n" + "git bisect start [--term-{new,bad}= " + "--term-{old,good}=]\n" + "\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 a revision after change in a given property.\n" + "git bisect (good|old) [...]\n" + "\tmark ... known-good revisions/\n" + "\t revisions 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.\n" + "\n" + "Please use \"git help bisect\" to get the full man page."), NULL }; @@ -1317,7 +1344,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; argc = parse_options(argc, argv, prefix, options, - git_bisect_helper_usage, + bisect_long_usage, PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); switch (cmdmode ? cmdmode : BISECT_STATE) { @@ -1368,13 +1395,15 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) res = bisect_run(&terms, argv, argc); break; case BISECT_STATE: + if (argc && + !file_is_not_empty(git_path_bisect_start()) && + !one_of(argv[0], "bad", "good", "new", "old", NULL)) + usage(bisect_usage); 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); - } + (!argc || check_and_set_terms(&terms, argv[0]))) + usage(bisect_usage); res = bisect_state(&terms, argv, argc); break; default: From patchwork Mon Jun 27 18:31: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: 12896989 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 147B8CCA473 for ; Mon, 27 Jun 2022 18:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240325AbiF0ShP (ORCPT ); Mon, 27 Jun 2022 14:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237501AbiF0Sga (ORCPT ); Mon, 27 Jun 2022 14:36:30 -0400 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 2727E18B23 for ; Mon, 27 Jun 2022 11:31:36 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id s1so14247123wra.9 for ; Mon, 27 Jun 2022 11:31:36 -0700 (PDT) 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=nXVMYcLWZAMrPSYJKYZsdZn/FbV67Pph+03E2sIMsUg=; b=ZhTlYEHqSSGORXgXD1vSjAPOLPHVZDwPO1vvshM/m7066hfyRwgvi12jlW/55EuKL9 LuIU1H3v87jSU96dR4y26WwW43fBrvAeyjdyZ8b6HgceOYps4PqwR16JbqdsUJSmJhHA wqONCJbWOMAs0uk6Qq1UjJBJCpv2EZZ5zEmxeKqJv8uNeHREbMCyChNwqe+1g17dnvOB exsWVvHaGcuhBdNDl8jhsBfsyt6YuC9IuAdXtFzSjN91GZn+ZqmdpUftzLYXlpvnfhXE H/C/K2VMiqIhd8Zmo94zERmHws5RKhHUyRVZPKd7grGOHOcbkrlrtnmmT9+AZAzBMomr NohQ== 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=nXVMYcLWZAMrPSYJKYZsdZn/FbV67Pph+03E2sIMsUg=; b=yaq2oIdh5UoYqZQVqkMbltPF9dOc1Vk4E3tqjSKvOjPCuDKxhcclubVPCeiD2VYrQl HVAKOwjvOBPJP9Y+/TWET/XQ/ODfgGQntUOzxOES02N0j0nyLhfavD+/H237iN7rwD9p UyNN4EsQbAU9+BWbbp802e6YbJeeZ1CMSs/62to/XwJ7B+8IIQG8tBJdCfdAYMj5mjJW fjdObi9n7Dh1C4nJh8iWc/TIQ2sCvlGRwi8Nj8HffAJpcNcfyXXrRdy+PsoV+3YpXB6W 8+nYMNFFF2ssXxLDiZuPwrYHexZx6mWDyOdEqCXpZND8zDn/8V7OsldNrS1Ej3FaCp+F Z4DA== X-Gm-Message-State: AJIora+sRZRyvKLlhKvIVqmKrwo3J96rXxbxx2i9xX84GJY6S1sK5lJL lSm6t5NMwWnZm4Q7yX92GDH4qFAnESRKzA== X-Google-Smtp-Source: AGRyM1uUbDeQuZhjRG5/Vpxlf0LyadksFaGXZckfa9S6AmT6Po11EQTVgSvuvbO8qq+58hbm7NnNww== X-Received: by 2002:a05:6000:1a8b:b0:219:ad61:f4e3 with SMTP id f11-20020a0560001a8b00b00219ad61f4e3mr14809892wry.190.1656354695323; Mon, 27 Jun 2022 11:31:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g4-20020a5d6984000000b0021bbc5a26cfsm8323410wru.79.2022.06.27.11.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:34 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:14 +0000 Subject: [PATCH v4 13/16] bisect: move even the command-line 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 , Bagas Sanjaya , 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 last step. Side note: The `parse-options` API is not at all set up to parse subcommands such as `git bisect start`, `git bisect reset`, etc. Instead of fighting an up-hill battle trying to "fix" that, we simply roll the same type of manual subcommand parsing as we already do e.g. in `builtin/bundle.c`. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 103 +++++++++++---------------------------- git-bisect.sh | 49 +------------------ 2 files changed, 30 insertions(+), 122 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 1914aa7c69f..7232d650905 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -23,7 +23,7 @@ static const char *bisect_usage = N_("git bisect [help|start|bad|good|new|old|terms|skip|next|reset|" "visualize|view|replay|log|run]"); -static const char * const bisect_long_usage[] = { +static const char *bisect_long_usage = N_("git bisect [help|start|bad|good|new|old|terms|skip|next|reset|" "visualize|view|replay|log|run]\n" "\n" @@ -58,9 +58,7 @@ static const char * const bisect_long_usage[] = { "git bisect run ...\n" "\tuse ... to automatically bisect.\n" "\n" - "Please use \"git help bisect\" to get the full man page."), - NULL -}; + "Please use \"git help bisect\" to get the full man page."); struct add_bisect_ref_data { struct rev_info *revs; @@ -1305,110 +1303,67 @@ 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"; + + if (!strcmp("-h", command) || !strcmp("help", command)) + usage(bisect_long_usage); - argc = parse_options(argc, argv, prefix, options, - bisect_long_usage, - PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); + argc -= 2; + argv += 2; - switch (cmdmode ? cmdmode : BISECT_STATE) { - case BISECT_START: + 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: - if (argc && - !file_is_not_empty(git_path_bisect_start()) && - !one_of(argv[0], "bad", "good", "new", "old", NULL)) + } else { + if (!file_is_not_empty(git_path_bisect_start()) && + !one_of(command, "bad", "good", "new", "old", NULL)) usage(bisect_usage); set_terms(&terms, "bad", "good"); get_terms(&terms); - if (!cmdmode && - (!argc || check_and_set_terms(&terms, argv[0]))) + if (check_and_set_terms(&terms, command)) usage(bisect_usage); + /* 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 Mon Jun 27 18:31: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: 12896987 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 7199DC43334 for ; Mon, 27 Jun 2022 18:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237487AbiF0ShL (ORCPT ); Mon, 27 Jun 2022 14:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239086AbiF0Sga (ORCPT ); Mon, 27 Jun 2022 14:36:30 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D3DE13E03 for ; Mon, 27 Jun 2022 11:31:38 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 189so5493964wmz.2 for ; Mon, 27 Jun 2022 11:31:38 -0700 (PDT) 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=/lcBQOqeRg76SKYk+xD2etkKLEfQ0I5qEgFQ6WV8kMQ=; b=E0ABHq/37zTbkCJ9P5sIm4WaP1IgHAlPmypLm0Ih5aba6d0LeS3Wz95RHKle+1Xyt4 64KSbfnhcJbNuPFLXArZkne/zJ+hIW6wU4Dnt1b3Ua4G3QKHc7HUN915SNT3+8qss9ud eL0jJAr/D41T9Qx89SVD9ozXS/0Xaxc1MD0Mgy+RL0SE47d+bcJwxisl+fE7HdlBcI/I 5amjHR/e/P2nLYa8WqBUeHCEpE6lH2tgVe7mWc3d3C2B2lr49VjU9EBIrSxhSkOZ8BXu GHosTAQa/ljt0600IYRT3ZTTRhthV/2Zakw+MM/dI6uDChmcBDJTezcgYHqH38BJLpnU M60g== 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=/lcBQOqeRg76SKYk+xD2etkKLEfQ0I5qEgFQ6WV8kMQ=; b=m+G7sctE3X9kCVU6wQ4ySBy4IvccIOJ5VYHVl6kx7CwPMaBc1UTpd0xoYeV8P24JLQ Cc3+gj/cJfXVdkG9Mz+AyyV8uZrbD/MA7Xct9R/2VXn1FE96EM96Oc6uvzOpLKi7fIzY VWZSLUJTLkM1nw9YdvT0zIvkowfZmWiuhhbdzzBHgy4/XmG1+UJ54yycoARzZk0Gzh2Y E9YcHfjyq376kaijA80kIGj+UGaA9luDow1uMtfkuLhwIzCoIy8gpRfLtZBbF2ZWFPPt +OsDCNDp1JWL15PfNHUo+pbCfrPPvI2qPBcQ+2m3CNjZ1aVfm4vvdX6iUc+2mZFRWfbe nEfQ== X-Gm-Message-State: AJIora+PB2T7n49VpBbDfFmVXk4oxRvpRR7YO8/TY3Dox+ZurZaCFU0P jaDtl23MYrpgQxgBpHj2yW+Kxuk28fHA9Q== X-Google-Smtp-Source: AGRyM1uClBdPHurLPXAVVDNWW9nnTub80avxcXsFVewIch7byvEMF6+A4VQt+SCTouZWzTTxUYs+Xw== X-Received: by 2002:a1c:f710:0:b0:394:1960:e8a1 with SMTP id v16-20020a1cf710000000b003941960e8a1mr16944551wmh.154.1656354696339; Mon, 27 Jun 2022 11:31:36 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y12-20020a5d4acc000000b0021b9416fa13sm12715154wrs.90.2022.06.27.11.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:35 -0700 (PDT) Message-Id: <378d6d227372405326112fee03c377f1aff386fc.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:15 +0000 Subject: [PATCH v4 14/16] 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 , Bagas Sanjaya , 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} | 2 +- git-bisect.sh | 37 -------------------------- git.c | 2 +- 5 files changed, 4 insertions(+), 42 deletions(-) rename builtin/{bisect--helper.c => bisect.c} (99%) delete mode 100755 git-bisect.sh diff --git a/Makefile b/Makefile index 04d0fd1fe60..3462bad4f15 100644 --- a/Makefile +++ b/Makefile @@ -619,7 +619,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 @@ -1119,7 +1118,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 40e9ecc8485..b9470f8ab4f 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 7232d650905..380fef852f3 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect.c @@ -1301,7 +1301,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) 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; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; 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 d7a7a82008b..1ad501058a8 100644 --- a/git.c +++ b/git.c @@ -492,7 +492,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 Mon Jun 27 18:31: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: 12896990 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 AFF79C43334 for ; Mon, 27 Jun 2022 18:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240329AbiF0ShR (ORCPT ); Mon, 27 Jun 2022 14:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239712AbiF0Sgb (ORCPT ); Mon, 27 Jun 2022 14:36:31 -0400 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 38BCF18B2D for ; Mon, 27 Jun 2022 11:31:39 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so6154966wmb.5 for ; Mon, 27 Jun 2022 11:31:39 -0700 (PDT) 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=PoF4Q/fqBbJ8ev1xLdRGGRicWOWXCjpw0TjrWxjcXrE=; b=JIlzEpEH2mx6LQR/SJ1WqffoCoRouFMWn5RcGuHq2l1aAQKktgHr1crRtmrfscF8Ki ApllpS56s0Dqtec4i9uFEiZ+FZM4rl1dQhZu3fwUI3Bp5ZLr3qrHX9YioiVY4Od383Nl VY+E3cPHDhUOkjOIwFz641sXV99MtZlkXSkFCCvxT1LGwnlOo54HA/27+NnB3MYYGfIs L5Ka7l36XLNww3ZuknNuZxImyRg5LEwERLhxakqDidRSH4KOe5lax1JdgJnk+5y4Ze7O /kgAvHP/c9KrvVh8X4e2bY2u1TZKm5HXT4RO2SV1lvOnBpd5h1G0Mql4VnkdxmQeb2Gs jwfQ== 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=PoF4Q/fqBbJ8ev1xLdRGGRicWOWXCjpw0TjrWxjcXrE=; b=p4GMWsMW9B0h355jzrFrs5CTbWuTsF2b0FPR5mXDEJj77XFrJ/yD+IfqF0bRyTzMXF 5ZtX+YxoiPFOysU5mj39tx+puf2OmOs0+GdZw2bgiaekrsES70TccPXS45XNKmjc2Gus vrVpOpVmTTKsKc8jksvA0WD6QqlTgVYx/ZAm4ex1e0oPxh7DHwbNfqGFTPNFz9GU2ObP 9C9cWZ1WZRK7b0QI5eWCHnfnRqot/6CU0Z2BwjsZUSDo2euU4441dRGqq2XNwky/t5Gd ntr21CYFfW/mRZLmVxHjTaKYzNTAUdI1ys1m8YGWbxKPXGww4ybfbUy2k6ThMC3kUVZj kShQ== X-Gm-Message-State: AJIora8o9k8h/mUPsR1ZO9d5M/zpgnCwoXnVp7iTuFhLcvqqw7H12eBm 0L5Bf8c+MzuSt+Yu4rlDJ2D7UPMVYUWgnw== X-Google-Smtp-Source: AGRyM1ty3P9gVnI0/pq1MCtG5/jw6KtmntVX84CDoVxujRuSIlUGUgQFdA9JC95NuUE4Tu15VPa/XQ== X-Received: by 2002:a1c:770b:0:b0:3a0:42d9:6f4e with SMTP id t11-20020a1c770b000000b003a042d96f4emr14970162wmi.164.1656354697466; Mon, 27 Jun 2022 11:31:37 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l17-20020a5d5611000000b002101ed6e70fsm11193171wrv.37.2022.06.27.11.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:36 -0700 (PDT) Message-Id: <33566b86d77dcc11d68b2aceec0b6c5218bf198e.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:16 +0000 Subject: [PATCH v4 15/16] 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 , Bagas Sanjaya , 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 380fef852f3..47103ebf3f2 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -14,7 +14,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") @@ -809,13 +808,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 Mon Jun 27 18:31: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: 12896988 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 E00DAC43334 for ; Mon, 27 Jun 2022 18:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240203AbiF0ShM (ORCPT ); Mon, 27 Jun 2022 14:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239636AbiF0Sgb (ORCPT ); Mon, 27 Jun 2022 14:36:31 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2782418E05 for ; Mon, 27 Jun 2022 11:31:40 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so6154986wmb.5 for ; Mon, 27 Jun 2022 11:31:40 -0700 (PDT) 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=2Kg7YV2cLc0sPso95VWf/nMyuinQpxkpBHDw1baPYHk=; b=Rk9zvJSy5oY5EJpcsJQ83GfqUQgDtjs6K/ceAVlNZLK6CctiVcAdRA/wEO1ypxNAck AW2bSZ8VTM6yz06jTQQvkRm+6Bv7+WrpbtnG3jSVDqRb/sSjrF+fbQJ38lcnF+Z2Hr2b sKbP4UkYOb2f2dgHLgfXLAF/bk+8aOdXOvSWZ8gb/Zy6IQh0P22OohLfh8rLopNc4LA3 73X5/Si1dUj15j68qZnISlLs+q3PtKy0QdyApb4Y7tBGJSADTXe/CWBV6XPPGsOeFpcq zDCF7HgG6yrP3b8fFqtOQx0CUnVm9nBE08N9dmf2g3CLk12TFOzKKn/m69gUsbJSaSdt B3hg== 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=2Kg7YV2cLc0sPso95VWf/nMyuinQpxkpBHDw1baPYHk=; b=tUxTCGNNsTEWzHf84psjUZ/XuB65YpCCmWUouCCpb9dzrOyOkz3GwdWN+kcAzQEMOO uj8FZoGPWSjTE+1FBdRLrMk9Z0kwMuh992YEUbgIDaygKvN3//M2DIidTc9wmRrm8OSe y42oi3+POHLO4gr1FQ3Fn3WFbhEvE2dZgb2Q1OqN4Jsfw3VoVgIfZMQWREiNRhczdUAI D5IVYIjt6ivCKydewaEHTMRoID2ZUJgHsPijUu5NkqCopktT3yFzoihPC+k2ARqHSVUz hMsc5PRrddSrxbGf32RhD6FDBKQCbhgnG1g8hm3fUjDKYQkVi+wf1aLbLIyYep/zGPIj Ekbg== X-Gm-Message-State: AJIora9AQ4Y94ZL8jld+HELQk+uUb3L/KZhk8veR+a1REFZD9ZVSQkwc XDM51nQ0e199T9uz099x4khDXsQhK61dMA== X-Google-Smtp-Source: AGRyM1sqeSXsg2Qi5/GbEcbGutFM5UWvKBHSHLGeyvbPfozFXxNaJrAPdAy4dXMUXDfjTWOW5BxepQ== X-Received: by 2002:a1c:29c1:0:b0:39d:86c0:3ece with SMTP id p184-20020a1c29c1000000b0039d86c03ecemr16743595wmp.138.1656354698455; Mon, 27 Jun 2022 11:31:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e3-20020adfef03000000b0021bbd525b8esm9454564wro.45.2022.06.27.11.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 11:31:38 -0700 (PDT) Message-Id: <334664f23a8fa5d3b0df4a00ba9c7c96772ab93b.1656354677.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 27 Jun 2022 18:31:17 +0000 Subject: [PATCH v4 16/16] 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 , Bagas Sanjaya , 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 b63669cc9d7..00bd4ba581c 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) { @@ -1181,8 +1180,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 7a76f204083..1d9cbf229e2 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -1000,7 +1000,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" '