From patchwork Sat May 21 14:48:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857904 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 54DA6C433EF for ; Sat, 21 May 2022 14:49:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352242AbiEUOtU (ORCPT ); Sat, 21 May 2022 10:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244384AbiEUOtM (ORCPT ); Sat, 21 May 2022 10:49:12 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A72506C57D for ; Sat, 21 May 2022 07:49:11 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id r9-20020a1c4409000000b00397345f2c6fso3583856wma.4 for ; Sat, 21 May 2022 07:49:11 -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=O949/NoqHYMVq0u8jklITGgLuSWa8z/4rEyyWnamH8k=; b=XrYtTCyhi2MouzPBmwDkHvLsX2pgIJhOEgVHy+Tp52haFp6OMHDcq9wJLWeUnOiLro lG25nO5X95n0HAk1a3zFecX87y2A0AC6a2gjuxrLga2wXvW3rGDLnOPJgPLEV/+wpoy3 o2mGOtCm0f7nb3cALnrJJxOYsWi9qTBWQq0zhw5GCmGDZ3/izoaVzc/Vb66ljVb15qb+ 9j25R2FsGDaqZmFy7P7lA44xujk+RP3FQWcUrnP9MTpY0qo9wBiSx/Mh/ngp6jiDqz+y sXj3juZxk2U9QHx7yxeTx7r1SF7SltAhhAMBvABIOXfVIEoxSZIsLg+Ee6jWjeByxefX OCcQ== 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=O949/NoqHYMVq0u8jklITGgLuSWa8z/4rEyyWnamH8k=; b=F18djlC4iNt4h75vU2Jzg/fMaeyju3t8r+WoaTyMUW917xTQI2OwKC+BoHuxLp+BSS EX99IqDxjfCXED+3xWebrU1H4k0Mqo3g3JturrVW1dw0F8Oz4isfKUOBcWPjNDxOgzu2 4762Jq240UH0rhdIFEm3AysgwjP3uEcn+ayPgFrinLanHz/QtIzYNt55ZLnrMzVch2x2 6huv7uAyNUMylEogdyhTloBWO5QXBaJwq1iBS2CWPBFAN8GbAgKchvRYqvOxZMGonId6 rXlfUfpjt0Ng0Lc5RL/a42YeUWh4BUWyjX+7j4FLG98ZBGW7QUzzYnCnfuk6SQjl6jGV NgXA== X-Gm-Message-State: AOAM530fPt1+yPiyh+Ezb3HI3RkUsTkjAm/w/V/enMoVng4Z+7Fs4GpB EFYkCEbVxPPaudgF+y8nr6azg0zluAM= X-Google-Smtp-Source: ABdhPJx6qyvNV0zVzILNPLqBk6aTKwzha47pu3VqjTC5HMnvJHkZQN8oNHv3FNXzGzvVCj95KIyp+g== X-Received: by 2002:a05:600c:1906:b0:394:5365:6720 with SMTP id j6-20020a05600c190600b0039453656720mr13197701wmq.102.1653144549884; Sat, 21 May 2022 07:49:09 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c358600b0039726cd3ae5sm5850828wmq.3.2022.05.21.07.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:09 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 21 May 2022 14:48:52 +0000 Subject: [PATCH v3 01/15] bisect run: fix the error message Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), we ported the `bisect run` subcommand to C, including the part that prints out an error message when the implicit `git bisect bad` or `git bisect good` failed. However, the error message was supposed to print out whether the state was "good" or "bad", but used a bogus (because non-populated) `args` variable for it. Helped-by: Elijah Newren Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 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 d4eaaa345ee..207479ee9ff 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1261,7 +1261,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 83931d482fb..0cacbf1469a 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -1053,4 +1053,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 Sat May 21 14:48:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857905 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 98C03C433EF for ; Sat, 21 May 2022 14:49:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355303AbiEUOtX (ORCPT ); Sat, 21 May 2022 10:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354011AbiEUOtO (ORCPT ); Sat, 21 May 2022 10:49:14 -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 D86216C57E for ; Sat, 21 May 2022 07:49:12 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id r6-20020a1c2b06000000b00396fee5ebc9so5747119wmr.1 for ; Sat, 21 May 2022 07:49:12 -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=Ah9dx3lCIjys14TYDWqaobQW8mneNvKLGgmPl3Bbfok=; b=OocSf3QPcPP/D7PcHr0g2hDNC2BoRICwerPWW2zwGK/iGoTZ+89911VhiUcC9IVNv+ 47FmTdF9AI760PePa/KSj4Gr4j31dKXSNRXPhBvR6khHQQ3+E8umFnzvAh8ogE2Mq8Dh qRGLyrbgiZzI1QbPsXUE/y7IbMW1bt5ak5wv9Xiwb+t69own8zm503y6qdXnkBVlhTBM DlwQXC4xrFZs5rtGLxaU08GN+MKQIZG1CItxONlxLEiM6ZHRrzMfy1uHXa1HNVt453B+ iK7d88mLqlpeZ45VRD2oAD4Era3rDDYBI5BpX+3hTICKdzBnkhMmVMshjcxP3apY27ij iiVQ== 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=Ah9dx3lCIjys14TYDWqaobQW8mneNvKLGgmPl3Bbfok=; b=Qp9S9dC2yIXCzBxCDsJbLA5gvlYEu0H753r9rFUbwiMM65+UWQS936WSlOmstBu8yO 2KVJsgwESCeRnuliCyXVEuadMXCeklpU2azlfyaX5hQpdmMhlPjTqVmCTz2a0Ja6mkgR pNwe1xuTEDCH0SCu37o+bxnZ2ibkwxFNb9+IjzMp6JCEA7+zvCCXcYLFJtQf+MLpsjl5 vw6Bo6zdvsEPBX5MFH8tC+YCUok0zNTqF7kqdfKGd8O6lsCvXP3lnjpC3OXaF7UXOHo3 /D5I5PgM187txST/mZcWKEu16xU8biMNWZAtFRkCqYVpFod0EDk3enLVarMjRCOXME/o iWlA== X-Gm-Message-State: AOAM533ArL1rjH/vgaVkdaXFy3xtRR1mcLS0wGVnO2YZ9nB+Br5rlIle Gwqb5QdJCvXVqwch/1HzknOCYkT7zY8= X-Google-Smtp-Source: ABdhPJxRtqpcCt8lixK/Jyd5hd3F/7Hmsi6SftzrH69sOCfTZrjuAUYEd0Uhyds0lGaxRqRtrPbjjg== X-Received: by 2002:a1c:7702:0:b0:397:3f81:2168 with SMTP id t2-20020a1c7702000000b003973f812168mr3406257wmi.168.1653144551166; Sat, 21 May 2022 07:49:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z17-20020a05600c0a1100b003973f4f3cdfsm1996179wmp.6.2022.05.21.07.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:10 -0700 (PDT) Message-Id: <955ccd4d8c895ec635b5937bec657c13e5c5e830.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:48:53 +0000 Subject: [PATCH v3 02/15] bisect: avoid double-quoting when printing the failed command Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We already quote the command via `sq_quote_argv()`, no need to enclose the result in an extraneous pair of single-quotes. Pointed out by Elijah Newren. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 207479ee9ff..0f49f52ac10 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1221,7 +1221,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 Sat May 21 14:48:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857906 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 40D70C433FE for ; Sat, 21 May 2022 14:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355307AbiEUOtZ (ORCPT ); Sat, 21 May 2022 10:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355161AbiEUOtQ (ORCPT ); Sat, 21 May 2022 10:49:16 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEBCB6CA9B for ; Sat, 21 May 2022 07:49:13 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id m20so3814285wrb.13 for ; Sat, 21 May 2022 07:49:13 -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=m6lfHmTVg76/Ms+dk9+LfC4GtStf7+QPlzIEK1unnOY=; b=PMJWfqWJtaom4R/N96ytUIbs53iwtPQ3YMdiloyXlwOi0fhzhYIgnd4hyWcrprl3VG bjIfcdLXLUTad7974eql3L6aDaJYCZj1E95NeUcP3ceV8FFSuqo9xlcwQzxCLniWF8NY YPwiGe240WlV+99LW2N+qoMGTpvU4o1tvQ3huedVoyO3SLgkN9KJV84+SvqTJT35XzR2 sNHcWUMahMXJlz0BDsZT1hNa7a8OYY3HxqwhThbu0/7RBTkbyNGu6ETZp6U1iZ3uVeJw IO/IAwlT3cC42Gmr30rWYIwOpoGyuNnEqj/cn0RxHl9/+wCTXYX5CQZfxtJrWcG7YtG9 Z9Dw== 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=m6lfHmTVg76/Ms+dk9+LfC4GtStf7+QPlzIEK1unnOY=; b=5+mCuknjifORtXpodk+cJiOvxNyUbOCOQwgxf2PX1lnXGbkrGaxJkHqldBsIUJP7CJ atXbfmTYmEttJKw3kYJq3st3zNBMXM0C8H53xJf7mmQ+9NfTTyGc7TmImnSwTI/fB333 ZO1DWO0k+uy8wz3arFAc4V6t9ZyxjO+S1K4r+C808M1WiV4/Gem67+ltw6Dgcl1sAGsg hRei6QZAkNE4waxsK+xtL//iuTm41VxZOSFWSNAkR0SDYa1YpNMtU1C2L99FsysdTGFY Ab2bF+OZlhA7n1WW8n5Z8nSqXcs1Bu7VJNl+eZyUhOqZQ17744eG/kQ7P+bUYsJGlPmE IMlg== X-Gm-Message-State: AOAM532ft7kuSXDZw7lfD6HBuu8iZhEki1Z6P7V6Qk8gS19nXBHwRlhH mkbxLx1jhcSd6ZK11l9u0sCoNIOf9Z4= X-Google-Smtp-Source: ABdhPJyMvxQ3omWcz/dayBSNKFp2qE9jg51/e/UnO7hWWSCVIks7PAPzLeZjlgPIg4r5Z/0AfjOXmQ== X-Received: by 2002:adf:f550:0:b0:20e:69df:5f05 with SMTP id j16-20020adff550000000b0020e69df5f05mr10745009wrp.194.1653144552128; Sat, 21 May 2022 07:49:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v2-20020adfc5c2000000b0020fcd1704a4sm1318079wrg.61.2022.05.21.07.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:11 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 21 May 2022 14:48:54 +0000 Subject: [PATCH v3 03/15] bisect--helper: retire the --no-log option Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Turns out we actually never used it, anyway... Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 0f49f52ac10..39556d60eab 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1290,7 +1290,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), @@ -1314,8 +1314,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 Sat May 21 14:48:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857909 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 D1AFFC433FE for ; Sat, 21 May 2022 14:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241353AbiEUOtd (ORCPT ); Sat, 21 May 2022 10:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355285AbiEUOtS (ORCPT ); Sat, 21 May 2022 10:49:18 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 242726CAA0 for ; Sat, 21 May 2022 07:49:14 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id j25so14925267wrc.9 for ; Sat, 21 May 2022 07:49:14 -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=O+l7uPKj2yOB/MlovFVopVk+H7ZTAfVlgNsDTtydHvA=; b=MfAtMbqasTede3PRFfpqnYeJNEVf253VxXDj8QlDLoQUNwWgj+ffDdU9dZXZzroxDY bPdrpqffhOBrfkMRQ/hPHMcTzUNEgcKo8jCN+v1++aruPVLxhL51+PWEc2FLwoilxG2N ICySJAanxGDsyVHu5QsGwQOTnK/z9xawmIqYmHzMZtJbfbs6uNXqwNs24SER4+6M0R87 VNWwspTZejkXpJ9QjvFMmj/gYd25VoQxbXaFOrqBzm4s/uta0kV3Mdf0G6kOFkldcRJZ 2uj0K18w0r2WPyT2/mV9UJSLtC5HR9OqXeSuAykLLq5xlNFuWFMkX7hY1Jk3JKG6MIKu 1Urw== 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=O+l7uPKj2yOB/MlovFVopVk+H7ZTAfVlgNsDTtydHvA=; b=MpH5ryx9GXPB0/NggCIELnMVMDb0/zwRWSb5F3dDa34xvj5QBFtADZqqtshzibRZ6M +I5WDd6L7pqihTqg80vgutrG31Hps6EKsiojZTgUlzEOptHy8ff7V2dwWmdw4gku7ZT8 2DKMNYDtLgLB/W/9JQqRmoWHWx8joYdbafxVjLeamIochSSjZVofSYWMBLj8pjX9GFqa 5xc88jOljnBUvmBIyvaHkYlnsej5XWNNS77m8YxkHszpHn8ORtlvxxN2/QEjd9HOcZZv 7zlpsNgEDy4j1EqR3tg7GlXvFmztVLqEfjV/8gZ6i6+tuEG7/D4Rdl9pV2DK+LwVZH/R b1OA== X-Gm-Message-State: AOAM533xeMo2hCU9bvGguwl3/PbX5It7JNpnb8P7LIdQb6roYmXL/bs/ E5o4pz0p3iYfQvTS0T/+w9iUMtQ3Ktw= X-Google-Smtp-Source: ABdhPJwaosZl+S0iiKftWbGwyFXrbD55noMcNJ2hcnvI+T8ZeEEaYNhtJGnEY89HV2UhtsNpQOLaFw== X-Received: by 2002:a5d:4d8a:0:b0:20d:2ba:7db8 with SMTP id b10-20020a5d4d8a000000b0020d02ba7db8mr12479006wru.624.1653144553263; Sat, 21 May 2022 07:49:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e6-20020adfc846000000b0020d02cbbb87sm5342125wrh.16.2022.05.21.07.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:12 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 21 May 2022 14:48:55 +0000 Subject: [PATCH v3 04/15] bisect--helper: really retire --bisect-next-check Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In 911aba14205 (bisect--helper: retire `--bisect-next-check` subcommand, 2021-09-13), we removed the usage string and the implementation, but not actually the option. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 39556d60eab..658390952b2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1278,7 +1278,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, @@ -1294,8 +1293,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 Sat May 21 14:48:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857907 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 38295C433F5 for ; Sat, 21 May 2022 14:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355312AbiEUOt1 (ORCPT ); Sat, 21 May 2022 10:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355302AbiEUOtS (ORCPT ); Sat, 21 May 2022 10:49:18 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640C96CF47 for ; Sat, 21 May 2022 07:49:16 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id bd25-20020a05600c1f1900b0039485220e16so5897086wmb.0 for ; Sat, 21 May 2022 07:49:16 -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=OTS4ftDKHJmiahNvw0ilJLOGCudFms86VmiHL0I/Lf0=; b=GhHI+392RXSjwhBszZqNRBkQOco7CnnAfag7VgHc5zdL4ZDaMyq1Sft+/QW6tzkJgf McV8eFpEOP743vviQmJuXbCHjaeumYb3CMGuE4VD/Sw3jcY1oygjZpNXViHKo7216y6g vbev0pTbAwUhK8uJKi7azjbVwQ9/EqPvnkCgJoRbK386FFw1yMeiTIUOzudTPBDU763q 9+gvYBl/FnGeeDeEPaKStX7J1Kfs3KNN1m1Q8XqJVTsiwSsXL6hZUcN85hi/1ZWb9IPF fCSatSt8V/TKMrWzxUjaq1bzC8IOBSUk/LeH9qEe+9ZfMYyu1kzBxagqVOK6fMMnIIzn H1Ow== 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=OTS4ftDKHJmiahNvw0ilJLOGCudFms86VmiHL0I/Lf0=; b=XsJzFW8s/knjL7OUtFpD1ueKwkqgnBLBAthS4NgPdtHkIl+EE7b9fHEPaYV1baegL2 on9WhZh94j3Fup+qj84AkX+gWJPKtSmiIh/MRIAyqzu+f13B3HY1RUdfj3G25Neui8UK QKAG56lZP6wnUq/LpyZYKoun2nUbYchyZX4l8rFoMDLc5uoafobIxHH1dy3HxBi0b52Q DNtNeWFDdIwGHDLgf1zybAjjWYUzcpfnjjBQH4WqpDjxcywf9nYucDcEOGOW+2bgAdzJ i6PVu9FF4lQ/P5hufiTihHr37baxahOcGG2b3ZO9J6CJTCke5Lqup+JIENM4xcIOPa/X i4Qw== X-Gm-Message-State: AOAM531rTe4HSsRUu4RfPAsldfU7fkTH8RTkzuQQBcZ+QE9JBzQoTWzS JEN7vyTK9tlei/vhsEFKUTGFHKrgIFY= X-Google-Smtp-Source: ABdhPJzCxp8/dSpZc2dsxa6LeWUiv83SsA7liLPOkfgL2GqGiYQfyUS46JBkEpyoptxAW8TnfbPkKw== X-Received: by 2002:a05:600c:6022:b0:394:81cb:8c9 with SMTP id az34-20020a05600c602200b0039481cb08c9mr12576637wmb.111.1653144554617; Sat, 21 May 2022 07:49:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n10-20020a05600c500a00b00396f8c79d22sm4140515wmr.11.2022.05.21.07.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:13 -0700 (PDT) Message-Id: <07a92c58f8e956d0906067131c5abdd990122698.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:48:56 +0000 Subject: [PATCH v3 05/15] bisect--helper: really retire `--bisect-autostart` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Since b0f6494f70f (bisect--helper: retire `--bisect-autostart` subcommand, 2020-10-15), the `--bisect-autostart` option is no more. But we kept the `enum` value of the command mode around. Let's drop it, too. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 658390952b2..8f4dab48379 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) BISECT_RESET = 1, BISECT_TERMS, BISECT_START, - BISECT_AUTOSTART, BISECT_NEXT, BISECT_STATE, BISECT_LOG, From patchwork Sat May 21 14:48:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857908 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 B243EC433EF for ; Sat, 21 May 2022 14:49:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355356AbiEUOta (ORCPT ); Sat, 21 May 2022 10:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355309AbiEUOtS (ORCPT ); Sat, 21 May 2022 10:49:18 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A87C6CA90 for ; Sat, 21 May 2022 07:49:17 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id k26so5917227wms.1 for ; Sat, 21 May 2022 07:49:17 -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=m8p1uOker6ZHhkQ0KrCQd/v90ZOXrFXuyLcdcKVGstA=; b=GDfeoLhnj944BWJr8ROHHf+azKQRhCjSxz5KlHIe5b9B+xySAbUuJWS2IiQsjneDT8 z3nFgKwcGqI2vixV4/zXRykJaLRpDJwyudlvy0fS/kF3ZxCIkC8n3c7cI9h0tfokTlxP yqKfMJF19szkV6R56IjZ/RguB4k2oW0ViawyzOkzUq6vKb5VuebpeAtzVXAnmRMwussx hnLXZAYA6hTPlZr5j+zpHzAe9lwjZAtrhUI90muzRBGaGt+Ia//hP6nZgfu7D1QPprnk uAIXNykoSjXYjl7+fMpYzISUL8HeR3yHP9Era9BZtjJekMbNSiF3g/eu+bpuuvSiMGzn cNkw== 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=m8p1uOker6ZHhkQ0KrCQd/v90ZOXrFXuyLcdcKVGstA=; b=z1QB3SfotYssYlKd+ylgAwTqt+c1QrG8WUaQ7aSYusYwfoh078ya6TTdY2CHvnhmJz BGe3kgz1JXRrzomRdKCtjX4Jzw4p9J7HGGvDOfYnbljrkABv/0+cp2Re15LSIpdOQSeU ohjxRdFjMs4kDhK4os5S9/TvBTqeyYUsgKpHA+tB8hzsMMfEatkQcB5NZA+EVYBNI/be bpvo0znkOxaGR0ItJ5onh90V9MdXdPlphNGmm/SyD1qFHeI+0LuFQK9odzdaLSM60etF 1Iq1dyYYUNFlLVgfha9rCtdV4pGvt+tVrKTg4E0CqEvf1s4qc1YS7OwoLMDIjy6GMLxZ jEdA== X-Gm-Message-State: AOAM532g1K6CqHRROzQdyXOQs91NehxgEvpOdkddCdygehJaO1oA1Co0 hrFAi/C1lt1WhwONvMm++c4jTkzG9Ys= X-Google-Smtp-Source: ABdhPJzkT5OkFwFFcUrgDVX2zsEyBFNnHWveoxywEitfcSflybiCrwPDNJ4lbw+U/McGMz8TxJAFJw== X-Received: by 2002:a7b:c841:0:b0:394:890e:9195 with SMTP id c1-20020a7bc841000000b00394890e9195mr13312737wml.59.1653144555701; Sat, 21 May 2022 07:49:15 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 186-20020a1c02c3000000b003973e27b789sm2834068wmc.27.2022.05.21.07.49.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:15 -0700 (PDT) Message-Id: <04ba0950b858e0c5b2549d8be52c89f12d579e92.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:48:57 +0000 Subject: [PATCH v3 06/15] bisect--helper: using `--bisect-state` without an argument is a bug Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin The `bisect--helper` command is not expected to be used directly by the user. Therefore, it is a bug if it receives no argument to the `--bisect-state` command mode, not a user error. Which means that we need to call `BUG()` instead of `die()`. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 8f4dab48379..343aedbc545 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -899,7 +899,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 Sat May 21 14:48:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857910 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 00509C433EF for ; Sat, 21 May 2022 14:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355314AbiEUOtf (ORCPT ); Sat, 21 May 2022 10:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355094AbiEUOtT (ORCPT ); Sat, 21 May 2022 10:49:19 -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 7FDAA6C57D for ; Sat, 21 May 2022 07:49:18 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id n124-20020a1c2782000000b003972dfca96cso3972809wmn.4 for ; Sat, 21 May 2022 07:49:18 -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=3dZ2Fnr276NklviQebVSsNuynuyJgrY0274sC/fw+2E=; b=o1MY0Czs8DcvmMsAYfw/Na7+Xm1I9hBHQva7oBaDHf1XI6yz3SIkX6N0HWY1YHlcyk p4UOsUwn3mSJDoQCm/38EQyo+DpLM+B2NDv3iHpBODc7vMErQvChlhW1Wc6giwJ/HO9s SGN7RpHE5qONWd1FqoMGMzxjvoPlD2Pu/P6DjhHhk9X+OmHXtfdGGc1Pd+sTM2mn1UaZ NB3EW1fIu08W+SbxJ+d7mhtiLnEZVwQC9rwsOZtR1Zz1WwYls1vYCY4qCkkA0V1+gaAG atSUcJ2UqXaMNAaVsIePrbq2kTi7/7+qg6xYrLX/YS16czi2cOVw61A48J8HYLMJQvRB Y5Eg== 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=3dZ2Fnr276NklviQebVSsNuynuyJgrY0274sC/fw+2E=; b=MG8ga3qYpZ2KwEQcLEmaATahpiOXi8giw05qegKmLAo51ephoKAMq5eKNW3yaf8R+H Vbs6Pe3JUmc5RR3mcuXczXQgBDZCiLW7yahhI07AAnWrIwqEfKIIbCrLkv/2LmZaVUZ5 51jN4Cl+K6HKy4tdw1XT8CPyvUp4ZyhdsGCKVpwEhNaDoEl51+elIvYqskPR2cpGszFT VashRocDiRLUJQ2UDapF+au+w6E7gXqiYd8b19Q1SztynyELdJ3Dc7VXuBZX7Wa74J4f hp/BKuoaxp+AStUZRfxIgZKFXj5BXBQLJY9mRaXL6GOpC5MdC36XJTtMYlVFQ3/OU1/3 /u0A== X-Gm-Message-State: AOAM533dH5/mP/tKyb/wYMUlm5TsKbQqfN97pGZMaRbS+XQNN0SGy4mb dd9aVe5ne8II8ZhmjwMY068L3IHwxsI= X-Google-Smtp-Source: ABdhPJyz6SflNbVDq7Aqpm0Vn+Fp1ER5p84qqn+oDbvN1AR+/x9MQBqagfqZ3Z1hBmLmzTOWQMcYug== X-Received: by 2002:a05:600c:5120:b0:394:6480:d595 with SMTP id o32-20020a05600c512000b003946480d595mr13365041wms.204.1653144556741; Sat, 21 May 2022 07:49:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k25-20020adfb359000000b0020d0a57af5esm5257454wrd.79.2022.05.21.07.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:16 -0700 (PDT) Message-Id: <6847af9d4859b3631cfec056f4c6e8d3120349ec.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:48:58 +0000 Subject: [PATCH v3 07/15] bisect--helper: align the sub-command order with git-bisect.sh Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin We are about to retire the shell implementation of `git bisect`, or maybe better put: the remainder of the shell implementation (a shell of a script, if you want). In preparation for that, align the order of the sub-commands with the way the outgoing implementation presents them to the user. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 76 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 343aedbc545..37a16c6ac1a 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1277,37 +1277,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() @@ -1322,19 +1322,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) @@ -1342,15 +1347,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) @@ -1358,14 +1362,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 Sat May 21 14:48:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857911 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 5B38FC433EF for ; Sat, 21 May 2022 14:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355325AbiEUOth (ORCPT ); Sat, 21 May 2022 10:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244384AbiEUOtV (ORCPT ); Sat, 21 May 2022 10:49:21 -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 9357B6CA89 for ; Sat, 21 May 2022 07:49:19 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id i20-20020a05600c355400b0039456976dcaso5668507wmq.1 for ; Sat, 21 May 2022 07:49:19 -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=txCyLIG842kVG4Wt19E7V9JZ6FcDgBZI2iSPks97yjU=; b=VxTYPHD2eh8ioLN3YHkh8ugRP1c5KlSKY5JqauZZglYEVtg8iPJnmOzoGjHusg9Du7 hUX8UR5ZaGVtW0QHfNV/ltDBCO/TsSH65jEavY7ataqInYWxLdFCowJ6arIo9puEB0XZ zW5XWKgnwCkWoMPiqpbPps9ba2bJqzsmDpN7EDuy3LF+jFG0xTw/CN1nkoGec1MgTKz8 layHbjINHmBpFZiN2j5NpuLfRQJvcAqn63zWHIvaEm/pHO2Fh6IGMW0bBXYFYjdh6ELR Sck4kKFElYcDSHHWZyQNHMRbrFfYIX6d+kImkF824miJAdbbtarX49423MrdCptvkOSL JN4A== 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=txCyLIG842kVG4Wt19E7V9JZ6FcDgBZI2iSPks97yjU=; b=qxe6YnSeF6zgmnCx5JQX2FMdP/4boqOe/EIobAfgwbavgywYG7o3pUBQpqyyJQqRqq TsTBlVNsAboCHmB1mstwK/uVxpGNg/IND9PjWqRAHqsmEcZhWm0rsDFo4kayJc35LtmF jOweTmDiUHJcQhT9Hf+bEwFTlIawGZdXhg2KhkvhwNd9nov2I7qicHA+QeM1+YwyimWc swip2am4tbRd7pdxysIsFKxMNbSib9kALqR/iEjFCdXi46UvsOx8cuZO6qm7WwaVYeCz d5WXq3dlcFpmseOoMoXTc/YOMpHyFrAtrdCKDoxvO25mmzo1VG57txuMF5o8SHWzKLud bFbg== X-Gm-Message-State: AOAM5318ZlChiv0FFNsnNGF15NVD9yjeMihpdW31RFkXq7PKaqRVCWnM /49UlwymQ4FtD4sgRkAjNEKGcpcgtKI= X-Google-Smtp-Source: ABdhPJz19V2DSOca6pyuAoueQSXvkRGQhZAscSuh43+/TneLMc0h7o/fv5otg6pKJ15AFGyUa2ly0w== X-Received: by 2002:a05:600c:89a:b0:397:3e2c:f416 with SMTP id l26-20020a05600c089a00b003973e2cf416mr4486234wmp.160.1653144557792; Sat, 21 May 2022 07:49:17 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q14-20020adfab0e000000b0020d0c9c95d3sm5306825wrc.77.2022.05.21.07.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:17 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 21 May 2022 14:48:59 +0000 Subject: [PATCH v3 08/15] bisect--helper: make `--bisect-state` optional Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In preparation for making `git bisect` a real built-in, let's prepare the `bisect--helper` built-in to handle `git bisect--helper good` and `git bisect--helper bad`, i.e. do not require the `--bisect-state` option to be passed explicitly. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 14 ++++++++------ git-bisect.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 37a16c6ac1a..94293318619 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", @@ -1318,10 +1318,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); @@ -1329,6 +1326,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 Sat May 21 14:49:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857913 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 7BA7DC433EF for ; Sat, 21 May 2022 14:49:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355395AbiEUOtm (ORCPT ); Sat, 21 May 2022 10:49:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355323AbiEUOt2 (ORCPT ); Sat, 21 May 2022 10:49:28 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6A86CAB3 for ; Sat, 21 May 2022 07:49:20 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id n6so5927376wms.0 for ; Sat, 21 May 2022 07:49:20 -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=PejT8pmtzgdvVrfZLRAxPp/aTwsIB4M0N2QYPwiWxtk=; b=Uy2H4SdtVvB6kNjDGif7yNJvT2oykABXOt3H1XbcB8Y2VSjQpb0dA55YOO2CayvILy 1Cw47k9Y3dvTbLdfdyReYUZKiFk/9Qh9fhYtzFG+0bM73d2hN/nmpLWD6FC9ttr5jLxO gH4z85nkjTba4YbLO2F6fjWgvxT+8xUzSXNrpvocfcLVYMf6Cl+xsFJWA9ysIysPKDZY Yh41mPS8WpozblZuH0OpzKaDO2Vh0boVBV0mOLMR4kIaUDlKWZjYxz4Bb3I6Tjr6WUOq Rc0ZxoVi/4Rt3BgBcM3ENGa/SalID99Jx0B2kRE+61sq9sbJwXmE/anviLkwrdSkLm9r Zkkw== 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=PejT8pmtzgdvVrfZLRAxPp/aTwsIB4M0N2QYPwiWxtk=; b=sUkR+VajZYZ+dqn5CCl5MbWYmNMNHAZIbgok4CFFnIHgK+d0gDP+8iR+tqwiNj7LUR wtfi96MRCWQu+KH0kmXPKzqJLOSg7c9HMsJG9zyGpoluGu4D0ZFAijVU6bJr+RcHPqz5 fTVuX5yVtdt5IAlMvHlvmcTUm7kU6P3SK/O10nAukxdzGJPpLIZBiqngoHbZmROcZySJ pVEG+yECmpVw4spTxGgkbGzBQlx8p6F+dX5VdAjs71XH8Edw6vClPdjhrgKeRHP58std vW8C++m/I5bmzHVmxlCaGlP8G5WKbLv2KS24c3qL+CxizeQljs+xVxnrAFrxpN2Vuj6E 9zxQ== X-Gm-Message-State: AOAM531ZrIdJzUKIBXQTedqIGiyVnJ8Ew/l+IDuXNCpj4UVGZHnz2UBf xrJB4gKZsfo6Gfd1xwo6vyH0FPW2Ljo= X-Google-Smtp-Source: ABdhPJyIh1rSAFyNvnWy8k8czJtja4lOiUtp2YAvYLZi/KcBTfLhJW/ulY4W7HzGgXBmSlkEIygwVg== X-Received: by 2002:a05:600c:4f0f:b0:394:54c1:f5b3 with SMTP id l15-20020a05600c4f0f00b0039454c1f5b3mr13460920wmq.33.1653144558783; Sat, 21 May 2022 07:49:18 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k25-20020adfb359000000b0020d0a57af5esm5257529wrd.79.2022.05.21.07.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:18 -0700 (PDT) Message-Id: <1919237a8197d8ef08abe03bc3cda113f3422761.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:00 +0000 Subject: [PATCH v3 09/15] bisect--helper: move the `BISECT_STATE` case to the end Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In preparation for replacing the command-mode parsing in `bisect--helper` with an if/else if/else chain, let's move the one command that will be implicit (i.e. what will become the final `else` without any `if`) to the end. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 94293318619..21a3b913ed3 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1323,16 +1323,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")); @@ -1375,6 +1365,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 Sat May 21 14:49:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12857912 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 45A59C433EF for ; Sat, 21 May 2022 14:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355344AbiEUOtk (ORCPT ); Sat, 21 May 2022 10:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355324AbiEUOt2 (ORCPT ); Sat, 21 May 2022 10:49:28 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E596C57E for ; Sat, 21 May 2022 07:49:20 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id m20so3814285wrb.13 for ; Sat, 21 May 2022 07:49:20 -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=dUX+CqJUEd3dcX/lC4M7Djb/lzbFu1ZfzGpJwYcOHS8=; b=RB5a6JMc3C+2nJZOi7oODwh5HTXyHC7+7vJlRIn6sg2Uw8JeQATLIz86FXiws5W7qY iSzOSkSpv3fwEAzOX3vbYpppeTdrCG+uR4tFQh4gTU9D3o7EvKRfHJupbCQCRKCUIq+M GMvcJJS4y/u0sqCMa/eNgLBqON5lk5Kbnmul400fb9OBOUSROm3nQ8igwj0M7KatHnmX 2NR7xFYOQotAQPMBLaMdnQEuLm5gtp8YJ750tBg9UYGZ5nsqSMFurcEiRk/hNXMxWy0X GtpDr+RZOjpCS48FihN4iiCESjXmPQahEJ/oRoaN0XfjSJyfnjnXZyT0xDkmanIi1FFG 63xw== 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=dUX+CqJUEd3dcX/lC4M7Djb/lzbFu1ZfzGpJwYcOHS8=; b=s+CBxds/n+a9g//Xbtszp69x7cXlvzPvjHHxAp1ZhqQ9j7+oeKcAP+T8n36odhJUGk jL5tlZSbinBexNtWLKpRXR2kNlIUW+cTedcClLb6uFugR0Z8Xa474y12uaiBy/nzSb5o SwlevUh6MkHjWJm8yX9p0SO1aP2FMP/YUCIg7B2TuFAxzXGk/Ev3qAETHCB/ticUm8F1 q8Hj0ENxSICaWUzidHcL5zzrLbEFlVttgmV0C5sBbDgrvw9hw8E1gM/yBb1m7U3Spubf MGiix59Hl6lbZh98/+Yw7wV4XJe9cPdZ4aBBBiaemCorj5HdET2l4LHyLXLJAhrmpCsx aeBw== X-Gm-Message-State: AOAM530uhW4U7Jkwxmwz16VlGjsR6TGsDxDE4f0jLVSZdYQB/ynWvL2u 8u9SnSq3y/VbGv+OegiXPBxGUSa1hA0= X-Google-Smtp-Source: ABdhPJziKThtg12tZ90C0q9zl8VW98Up0YKaJMfh2IaIJ42JaojpoW8MKD2NDHYr4wARa05/PKekbw== X-Received: by 2002:a5d:6042:0:b0:20e:65c0:f69b with SMTP id j2-20020a5d6042000000b0020e65c0f69bmr12555658wrt.524.1653144560008; Sat, 21 May 2022 07:49:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b003942a244f4fsm4387893wml.40.2022.05.21.07.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:19 -0700 (PDT) Message-Id: <1236a7319033a67befe34ed892db0eb5200490fd.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:01 +0000 Subject: [PATCH v3 10/15] bisect--helper: return only correct exit codes in `cmd_*()` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Exit codes cannot be negative, but `error()` returns -1. Let's just go with the common pattern and call `die()` in `cmd_bisect__helper()` when incorrect arguments were detected. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 21a3b913ed3..824f84ae76f 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1325,7 +1325,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: @@ -1335,13 +1335,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: @@ -1350,18 +1350,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 Sat May 21 14:49: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: 12857915 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 183A9C433F5 for ; Sat, 21 May 2022 14:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355397AbiEUOtt (ORCPT ); Sat, 21 May 2022 10:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355333AbiEUOt3 (ORCPT ); Sat, 21 May 2022 10:49: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 F3ED36CF70 for ; Sat, 21 May 2022 07:49:22 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id h5so13818882wrb.11 for ; Sat, 21 May 2022 07:49: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=AZfg7ldQb3mykbJM/3Wnop0ik5mI6PV69CBzGVDQxR4=; b=aNY5fhXZDKfAhNvmbLtVIHipw72i5Vn3KRru1n9fwcQ2N3cuukR+tCRvEdC0qVa+ve DRvyYTJq2xHTJM6XEJ5xTPiGl0gDjl8Pdt5M8ZoBTAYbKS7YAZGR7w8kEW7uaziO3qwO ZJ9LbczZtNoAJ902WZ/o93trjdEclCgY87SsM9pmYnWZU/9tz8G3LoGKHvF7CgFQCo0E R64Vxraa7KIHPu4qhVZwWYFzMjX1NXNS3A3+tcFMkTSROoojlXvly52D/31spKhJccin /GbHPfbacKTKQfS0hvHbOuHk4e6xqfb/oUAjN66wc2eV7rI7eLsRrQL5XpOkGAIhumvc ODew== 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=AZfg7ldQb3mykbJM/3Wnop0ik5mI6PV69CBzGVDQxR4=; b=E9e7b53GgfPE6WDUQuYLUb1wYO4s8tUQQlcYtnEokeBttj04wElqb/z8wRBiSt7JtA C5DWvCwKeE1KoGVkX/tnlmQg9XJnzothLYiHGuiiSu80cH2yPJn0ngKxDz6CshSEdsL8 y4NTSPtB6tyosBX8arRf1exNd/vdJPAX3y1v3B/Js9Ny5gXcDB0MEYtlGMl57/DETBLY RdcwmMMUBMbSxleSI2NCfNdLpSuroGhey+b6H0kSDUqx/ep++h62lrn9Wjj00WVzB8/2 y21jKUBvBmLamK+FaO6qavvUC8tTUj8w3Ape1vo8i4KRGnc67p2tYKOuoKNrvIli+T7I x6Yw== X-Gm-Message-State: AOAM531hvaVrDNTlQqqlIr/fvDAICqWwvlVnUUcCFFP1CzanHTmoPkEN SVkoo6dRLQ6dJ4F8a9jYP4VKOSEl++I= X-Google-Smtp-Source: ABdhPJyCZKkJW9r1VUuPMKhbGephGMLFZkG8ogq1l9U7lf3Fv95oCZJqE/aoeSYGgi8Clv885Mullg== X-Received: by 2002:a5d:4e50:0:b0:20f:ca28:358f with SMTP id r16-20020a5d4e50000000b0020fca28358fmr2321595wrt.449.1653144561142; Sat, 21 May 2022 07:49:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b11-20020adfc74b000000b0020e68218048sm5610177wrh.93.2022.05.21.07.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:20 -0700 (PDT) Message-Id: <4ae78d37d04789b2cadb059088e59af80a850c15.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:02 +0000 Subject: [PATCH v3 11/15] 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 , 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 one of the last steps. 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 | 91 ++++++++++++---------------------------- git-bisect.sh | 49 +--------------------- 2 files changed, 27 insertions(+), 113 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 824f84ae76f..89ff688a4a2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1276,108 +1276,69 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { - enum { - BISECT_START = 1, - BISECT_STATE, - BISECT_TERMS, - BISECT_SKIP, - BISECT_NEXT, - BISECT_RESET, - BISECT_VISUALIZE, - BISECT_REPLAY, - BISECT_LOG, - BISECT_RUN, - } cmdmode = 0; int res = 0; struct option options[] = { - OPT_CMDMODE(0, "bisect-start", &cmdmode, - N_("start the bisect session"), BISECT_START), - OPT_CMDMODE(0, "bisect-state", &cmdmode, - N_("mark the state of ref (or refs)"), BISECT_STATE), - OPT_CMDMODE(0, "bisect-terms", &cmdmode, - N_("print out the bisect terms"), BISECT_TERMS), - OPT_CMDMODE(0, "bisect-skip", &cmdmode, - N_("skip some commits for checkout"), BISECT_SKIP), - OPT_CMDMODE(0, "bisect-next", &cmdmode, - N_("find the next bisection commit"), BISECT_NEXT), - OPT_CMDMODE(0, "bisect-reset", &cmdmode, - N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-visualize", &cmdmode, - N_("visualize the bisection"), BISECT_VISUALIZE), - OPT_CMDMODE(0, "bisect-replay", &cmdmode, - N_("replay the bisection process from the given file"), BISECT_REPLAY), - OPT_CMDMODE(0, "bisect-log", &cmdmode, - N_("list the bisection steps so far"), BISECT_LOG), - OPT_CMDMODE(0, "bisect-run", &cmdmode, - N_("use ... to automatically bisect"), BISECT_RUN), OPT_END() }; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; + const char *command = argc > 1 ? argv[1] : "help"; - argc = parse_options(argc, argv, prefix, options, - git_bisect_helper_usage, - PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); + if (!strcmp("-h", command) || !strcmp("help", command)) + usage_with_options(git_bisect_helper_usage, options); - switch (cmdmode ? cmdmode : BISECT_STATE) { - case BISECT_START: + argc -= 2; + argv += 2; + + if (!strcmp("start", command)) { set_terms(&terms, "bad", "good"); res = bisect_start(&terms, argv, argc); - break; - case BISECT_TERMS: + } else if (!strcmp("terms", command)) { if (argc > 1) - die(_("--bisect-terms requires 0 or 1 argument")); + die(_("'terms' requires 0 or 1 argument")); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); - break; - case BISECT_SKIP: + } else if (!strcmp("skip", command)) { set_terms(&terms, "bad", "good"); get_terms(&terms); res = bisect_skip(&terms, argv, argc); - break; - case BISECT_NEXT: + } else if (!strcmp("next", command)) { if (argc) - die(_("--bisect-next requires 0 arguments")); + die(_("'next' requires 0 arguments")); get_terms(&terms); res = bisect_next(&terms, prefix); - break; - case BISECT_RESET: + } else if (!strcmp("reset", command)) { if (argc > 1) - die(_("--bisect-reset requires either no argument or a commit")); + die(_("'reset' requires either no argument or a commit")); res = bisect_reset(argc ? argv[0] : NULL); - break; - case BISECT_VISUALIZE: + } else if (one_of(command, "visualize", "view", NULL)) { get_terms(&terms); res = bisect_visualize(&terms, argv, argc); - break; - case BISECT_REPLAY: + } else if (!strcmp("replay", command)) { if (argc != 1) die(_("no logfile given")); set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); - break; - case BISECT_LOG: + } else if (!strcmp("log", command)) { if (argc) - die(_("--bisect-log requires 0 arguments")); + die(_("'log' requires 0 arguments")); res = bisect_log(); - break; - case BISECT_RUN: + } else if (!strcmp("run", command)) { if (!argc) die(_("bisect run failed: no command provided.")); get_terms(&terms); res = bisect_run(&terms, argv, argc); - break; - case BISECT_STATE: + } else { set_terms(&terms, "bad", "good"); get_terms(&terms); - if (!cmdmode && - (!argc || check_and_set_terms(&terms, argv[0]))) { - char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]); + if (check_and_set_terms(&terms, command)) { + char *msg = xstrfmt(_("unknown command: '%s'"), command); usage_msg_opt(msg, git_bisect_helper_usage, options); } + /* shift the `command` back in */ + argc++; + argv--; res = bisect_state(&terms, argv, argc); - break; - default: - BUG("unknown subcommand %d", cmdmode); } + free_terms(&terms); /* diff --git a/git-bisect.sh b/git-bisect.sh index fbf56649d7d..028d39cd9ce 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -34,51 +34,4 @@ Please use "git help bisect" to get the full man page.' OPTIONS_SPEC= . git-sh-setup -TERM_BAD=bad -TERM_GOOD=good - -get_terms () { - if test -s "$GIT_DIR/BISECT_TERMS" - then - { - read TERM_BAD - read TERM_GOOD - } <"$GIT_DIR/BISECT_TERMS" - fi -} - -case "$#" in -0) - usage ;; -*) - cmd="$1" - get_terms - shift - case "$cmd" in - help) - git bisect -h ;; - start) - git bisect--helper --bisect-start "$@" ;; - bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - git bisect--helper "$cmd" "$@" ;; - skip) - git bisect--helper --bisect-skip "$@" || exit;; - next) - # Not sure we want "next" at the UI level anymore. - git bisect--helper --bisect-next "$@" || exit ;; - visualize|view) - git bisect--helper --bisect-visualize "$@" || exit;; - reset) - git bisect--helper --bisect-reset "$@" ;; - replay) - git bisect--helper --bisect-replay "$@" || exit;; - log) - git bisect--helper --bisect-log || exit ;; - run) - git bisect--helper --bisect-run "$@" || exit;; - terms) - git bisect--helper --bisect-terms "$@" || exit;; - *) - usage ;; - esac -esac +exec git bisect--helper "$@" From patchwork Sat May 21 14:49: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: 12857914 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 78F34C433EF for ; Sat, 21 May 2022 14:49:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355323AbiEUOtq (ORCPT ); Sat, 21 May 2022 10:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355335AbiEUOt3 (ORCPT ); Sat, 21 May 2022 10:49:29 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157B06CF7B for ; Sat, 21 May 2022 07:49:24 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id r23so14980491wrr.2 for ; Sat, 21 May 2022 07:49: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=xOuCTQ8othQu7M3wU3lEArKTkeDfPToh5569gOStC3g=; b=JF/QizqiRMX1/BReeVZPdrOtE6mlaRHt+uW/w9SS+PgE+rC0eg1+Bq0Yk851Ze1UIV gRQdlHyTEbph3uVhsq6xs66xRjK35QYrUCrUiO3IGQOsB57RWmdA1ob9a4+AzRyMdA34 Il4yMW613OMlY9BxGe+KXSXy5YuTulVBI5iEoeO6S7PojJqoJn8yJHPCMJAN7Zhjs9b7 fdCWcSPGRG9wtbPf4FZI4Ol0laQQm601bEzm+RMl4LqmFbklZ9ga5lQkLooZ6tq9YeHb djQeul8D63lZbk6jmOW4MNSeFw/IKtDe+TORtgKPHlDIrREsZOvVqDNMtChX4jt0s3Lq NKFQ== 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=xOuCTQ8othQu7M3wU3lEArKTkeDfPToh5569gOStC3g=; b=OkZ/duiwBCalyc53BkDxv8bABac9xF+b/uSkQ+eC2OVBs9VeXK+9Ulco/sOp969TZE GL/4WTkZUf4kLw4DHpLsKoSFBgKNjtiKdAEVtzU+qwp3z7OLVwXwH082227k0bW4o+S+ 4bsRS9LT05FCtwNVDgVXkR4fAZrq83EyAEqFZlKD0AGQUhKhUSLEHpAdKb0Z8tWIoYEp VXTOylqDgJ2VbVK5/ZniEsnrnBvZ444LeO5ivdpFtaUktJOLD4eYhAdLtyr41Ivmn3Gg BU7SCSyplJzmiHIVnAnVuNcrsweshWk8xrtC4+0F6K9MxnyTI1Zj75LrwTDAG3y4+p0D GnZg== X-Gm-Message-State: AOAM532nkL/tN05VgyPpkQjs1De7MA8EKYZE9nRvwVbVgVhcY0kUdy+i WveeUyoQA/eEOn2GLo53Ciwro6TmpZs= X-Google-Smtp-Source: ABdhPJy+AlvLhjrQvtfM+uWYhYr8raKQ1z6mGfxLGvA09sdNRYL/TBeh3dzxgWJZfIf7Mdtjpe6t/g== X-Received: by 2002:a05:6000:1a85:b0:20c:7ba1:737b with SMTP id f5-20020a0560001a8500b0020c7ba1737bmr12239595wry.209.1653144562236; Sat, 21 May 2022 07:49:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c211100b003942a244f4fsm4387954wml.40.2022.05.21.07.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:21 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Sat, 21 May 2022 14:49:03 +0000 Subject: [PATCH v3 12/15] 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 , 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. With this patch, the `bisect--helper` command is able to do everything that the `git-bisect.sh` script could, leaving as last step only to retire that script at long last, which we will do in the next commit. Note: Since we cannot use the `parse-options` API to handle the subcommands of `git bisect` anyway, we no longer use it even just to show the usage string anymore, either. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 69 ++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 89ff688a4a2..a68f2c5a919 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,20 +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 ..."), - NULL -}; +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 *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."); struct add_bisect_ref_data { struct rev_info *revs; @@ -1277,14 +1302,11 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { int res = 0; - struct option options[] = { - 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_with_options(git_bisect_helper_usage, options); + usage(bisect_long_usage); argc -= 2; argv += 2; @@ -1327,12 +1349,13 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_run(&terms, argv, argc); } 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 (check_and_set_terms(&terms, command)) { - char *msg = xstrfmt(_("unknown command: '%s'"), command); - usage_msg_opt(msg, git_bisect_helper_usage, options); - } + if (check_and_set_terms(&terms, command)) + usage(bisect_usage); /* shift the `command` back in */ argc++; argv--; From patchwork Sat May 21 14:49: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: 12857917 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 D4489C433EF for ; Sat, 21 May 2022 14:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355321AbiEUOt4 (ORCPT ); Sat, 21 May 2022 10:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355342AbiEUOta (ORCPT ); Sat, 21 May 2022 10:49:30 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B94B6CF51 for ; Sat, 21 May 2022 07:49:24 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id t6so14953189wra.4 for ; Sat, 21 May 2022 07:49: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=hJwNNNqAeh0XsOJhXXlCEFiY+grfskTHoM+y0Zqn21s=; b=hmKRoNFDe8ngvI9cRUn4hd5h8fKC2ffCeit3PLZYOdx8ayiFQyLGr/+d65L8WZRA4i soHqEpW3ORgbVpSw99vCvIeetPr5yJHr/UE59pamEWzqfhOL+Qe5+mOZSurDGaRFy5n1 +AaTGjs9P34mtkynHUD3pYbQIjcAa+blA3L1X3vxf8dtot3IOGvNUQNrYXSDBzyTPXLy Z5hVP1IDwNTDivhTdlJ/hd+BBlCrwURngbRtFfkGBkW5LRxkwsggTKWB3R+Nhk0W3bn8 PqTut84PYtePynvB6UDJZIRvlUOA0Y45exFgXu/qoMEq4DEc6i+mKDNp9h3ecUbN146c BaNA== 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=hJwNNNqAeh0XsOJhXXlCEFiY+grfskTHoM+y0Zqn21s=; b=SbdFx391eezEpINvbCS284Gpdg5p9w4LW5NfsB7GrYBhhHO7xvXQC3v5sQvpb+NEiF TBrpXmHVTNKxud4/i8FC5SQqCh5siUD3ehkumJ7OLZCKAxgyg3k+kAc6+YVwS4DVYZhI 3oenYCmt+6q03wWfOL5Cgt99x6kd6oDj8KYvgG+sK4lA1YttdeLlO5D7/IVbnrbJET5B lA7wlPoJSSewSR/XEoRoo2H/9/TBQFQ/q7pAXQzQ7ZS5D+YOdSrt+KfjeJR49WcDPuKq 0PHKHMgEl1Z+tVfur6G2iae9UVscFzTZtF8buKV966Dn8a/sJjxhBOm6/Ji344TizqWG 70tw== X-Gm-Message-State: AOAM5335E7ufmlzYsprIGvZ9+CcBM9Wf2AsFIDpszd1LqIzih7LhSfiY SUi6KnPYF/sUD9881GbdIz2l9uKHXyk= X-Google-Smtp-Source: ABdhPJxMOTyUM5UuHezsIYQG09Yo5IIMEolRLOpUuj3zE7iF6c7k1AcmizKWn7CQSv7eNqI6Td1W8Q== X-Received: by 2002:a5d:6484:0:b0:20f:cc0b:e3f1 with SMTP id o4-20020a5d6484000000b0020fcc0be3f1mr1849091wri.237.1653144563326; Sat, 21 May 2022 07:49:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c24-20020a05600c0ad800b00394975e14f4sm4573378wmr.8.2022.05.21.07.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:22 -0700 (PDT) Message-Id: <85f5c256ae3e1014d42b3f76e16224a375f64360.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:04 +0000 Subject: [PATCH v3 13/15] Turn `git bisect` into a full built-in Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Now that the shell script hands off to the `bisect--helper` to do _anything_ (except to show the help), it is but a tiny step to let the helper implement the actual `git bisect` command instead. This retires `git-bisect.sh`, concluding a multi-year journey that many hands helped with, in particular Pranit Bauna, Tanushree Tumane and Miriam Rubio. Signed-off-by: Johannes Schindelin --- Makefile | 3 +-- builtin.h | 2 +- builtin/{bisect--helper.c => bisect.c} | 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 61aadf3ce88..824b8a43576 100644 --- a/Makefile +++ b/Makefile @@ -611,7 +611,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 @@ -1107,7 +1106,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 a68f2c5a919..d33de133c8c 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect.c @@ -1299,7 +1299,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 5ff4f3e25b7..40ed082e621 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 Sat May 21 14:49: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: 12857916 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 CBA94C433EF for ; Sat, 21 May 2022 14:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355382AbiEUOtw (ORCPT ); Sat, 21 May 2022 10:49:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355341AbiEUOta (ORCPT ); Sat, 21 May 2022 10:49:30 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D7786D19A for ; Sat, 21 May 2022 07:49:26 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id t6so14953869wra.4 for ; Sat, 21 May 2022 07:49: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=cZ+LNH8O8gwPm9WYchSe9lh5S7QD6NeSB/sWAdzc4uc=; b=Xmi2eJMGCku2DWywG9jJnMqBW6EoCg4bEHGUOw6+OAXn6k6iQMun7x9/q02r3Ry2Xw S/UqVxLAIW6G4xSw8/+g2gA1bPM3vd2C8hwCTVZf6WQ5hBF4faMwVUVBlJlJIkXcWeMp U9bzFow2zfrw75U1JtHlYd6Y4Jv6T7OPmFi4xDrW4ep8ItFSR2bayJn49Mh6Lh8m38+F Iu8Ijh4gHiVNKkzK46vxkfhJuSYlowmAZwu0BsSfxPuviNOlaqzOBhOEfDSIVoaWK6t3 KnyigR029HYp2p2imX+k6jWXdmobSiZ9K9gXhtQzdxVYAtJ7POTGVE+536vJ5HzIG+Zo dEOg== 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=cZ+LNH8O8gwPm9WYchSe9lh5S7QD6NeSB/sWAdzc4uc=; b=JmRpvhqaxXpvLxEiYmbj1QJN2caZOV1iUMdfYUhmCfUk1DTORGRm5n8g1ZJ1ctlgT/ 77fR7qUGTsjIEr3pxHoY8enY5P514DL5SbM+vW4oYMD4IRpPjECc6ZYMr4qOFLhhUumE WsDYcnOJxsF6Ckva2l7Qz3iuPDqznUq6eE9pJgUmpEIIgZ/pnRoVOWFLInmrENCu/t6C skmSWbZmWcAACx5PJyMIgDCm58MFFb8RQ/s0WYpmnEEDRjylf0I1zTLiis5MSgOykgf/ /LU2MQ2kHbPj1P9U2T80etssfHUSIG0E4yMweeoTIjX2DfmzsO0KcgC6oOGENZQqjyvG Dhcw== X-Gm-Message-State: AOAM532eZ2yfDjPs/lENPhQ1d0nzKowhtn+mmI6BDV/eNNheA51rprus d0GiTvBVCEVNC6Ezd15oyr6KSi+6olI= X-Google-Smtp-Source: ABdhPJyoEaTwdfJkNP1pFQ4mvRxtwOH5Ltk0FAi8aPNZdGfx8M4HSAR4bmeAQzMYHcFlER0rPyUAGQ== X-Received: by 2002:a5d:5442:0:b0:20f:ca5b:bbca with SMTP id w2-20020a5d5442000000b0020fca5bbbcamr2139058wrv.704.1653144564436; Sat, 21 May 2022 07:49:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x18-20020adfae12000000b0020c5253d8e1sm6528538wrc.45.2022.05.21.07.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:24 -0700 (PDT) Message-Id: <289917e96af373bceb0e11d1e33042e9d9225ce5.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:05 +0000 Subject: [PATCH v3 14/15] bisect: remove Cogito-related code Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Once upon a time, there was this idea that Git would not actually be a single coherent program, but rather a set of low-level programs that users cobble together via shell scripts, or develop high-level user interfaces for Git, or both. Cogito was such a high-level user interface, incidentally implemented via shell scripts that cobble together Git calls. It did turn out relatively quickly that Git would much rather provide a useful high-level user interface itself. As of April 19th, 2007, Cogito was therefore discontinued (see https://lore.kernel.org/git/20070419124648.GL4489@pasky.or.cz/). Nevertheless, for almost 15 years after that announcement, Git carried special code in `git bisect` to accommodate Cogito. Since it is beyond doubt that there are no more Cogito users, let's remove the last remnant of Cogito-accommodating code. Signed-off-by: Johannes Schindelin --- builtin/bisect.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/builtin/bisect.c b/builtin/bisect.c index d33de133c8c..8f32ccb47b7 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") @@ -808,13 +807,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 Sat May 21 14:49: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: 12857918 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 22DC3C433EF for ; Sat, 21 May 2022 14:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355378AbiEUOt6 (ORCPT ); Sat, 21 May 2022 10:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355351AbiEUOta (ORCPT ); Sat, 21 May 2022 10:49: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 76B206D186 for ; Sat, 21 May 2022 07:49:27 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id o12-20020a1c4d0c000000b00393fbe2973dso8307335wmh.2 for ; Sat, 21 May 2022 07:49:27 -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=GteBg2+Y1zMQghDuakrZG4uzNScXheViXbmGzF4Gshc=; b=BplVoXOkROFpNcURdNd/i022xi0HOoWbq4ff6GJJgc8Pa+Rz8B2tYJgkRISPCups9m 0lRULPZ3PORU9pUoEWqYsgkEf3aDrCAO2kC8vn0zYDAOpAthTQs6rllnsGIPiltg9tTE S6IeT7CQXYJVZs8y9cIoNfLWyp7Lt7QhdhjWSdewH0hp3ioe/oAthOe4zI/9dlnVhXF7 bPeoiLWcej0h/bY+4DOOueJnBF3CrshfBZ13hobYB8L6hjeT2Ojl5Krvih2lJO+25HJX JZWoalIHWx5BWbqe+Tgh1hsMVCji7kR1y0boF5D/+yb4U1saFgWkFXz+6GnVFVzjgrUa Ly0A== 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=GteBg2+Y1zMQghDuakrZG4uzNScXheViXbmGzF4Gshc=; b=XTxcHKJGDGyUrRHGSjQOknk7CFLU/Fn0uQcRyUYQihTC7DsZc4yyO36H3Fl+8izrjw Mq2juKhQWzEc68TbRE4JUFH/v63l3ozstz8dUlL+boBAz9WrU4uAs/GHlp5fUo16Gism Zssr+dSzMt4GJEQ0MKd1jUnA/RepH1VY30tYxnABOhEx80MvOvDrgPgfZEsPz8eHoZFg lN9/rt+/sThQit6sz70rH5+qDqxpNa5TGZDMNOIH6GCJ54ug5IxvyPqqlv0qjLGM6SBC 2A4cUBwntnI+i6V1Ago8nOZO1YLAEq07eLVSp3MXndcaN9GJJ/37jBNpqsOfdIr9/Fw0 e+Dw== X-Gm-Message-State: AOAM531bbafeApj8DDj3fKyaCC4h2SrKQr1kw2WQmxBKzxrD+19CI6B5 aBJ9BoZVBAWkUQAHeqKJUh3Wg+WvXF0= X-Google-Smtp-Source: ABdhPJyJdMRcu147hU4o02PS4ULr2WsA/kIp6djIEIhcAVgv6PwahGTYWabenGR4DWl70yGgqSmdKg== X-Received: by 2002:a05:600c:4fd4:b0:394:8e96:6d3b with SMTP id o20-20020a05600c4fd400b003948e966d3bmr12686551wmq.180.1653144565567; Sat, 21 May 2022 07:49:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u25-20020adfae59000000b0020d106c0386sm5350789wrd.89.2022.05.21.07.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 07:49:24 -0700 (PDT) Message-Id: <8f8d2ba0fe41583716419645ed74c3ffb0f85d77.1653144546.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 21 May 2022 14:49:06 +0000 Subject: [PATCH v3 15/15] bisect: no longer try to clean up left-over `.git/head-name` files Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Elijah Newren , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin As per the code comment, the `.git/head-name` files were cleaned up for backwards-compatibility: an old version of `git bisect` could have left them behind. Now, just how old would such a version be? As of 0f497e75f05 (Eliminate confusing "won't bisect on seeked tree" failure, 2008-02-23), `git bisect` does not write that file anymore. Which corresponds to Git v1.5.4.4. Even if the likelihood is non-nil that there might still be users out there who use such an old version to start a bisection, but then decide to continue bisecting with a current Git version, it is highly improbable. So let's remove that code, at long last. Signed-off-by: Johannes Schindelin --- bisect.c | 3 --- t/t6030-bisect-porcelain.sh | 1 - 2 files changed, 4 deletions(-) diff --git a/bisect.c b/bisect.c index 9e6a2b7f201..8f46c3813ce 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) { @@ -1173,8 +1172,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 0cacbf1469a..d4846ca4de1 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -990,7 +990,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" '