From patchwork Fri Jan 28 00:12:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727568 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 74381C433EF for ; Fri, 28 Jan 2022 00:12:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344485AbiA1AMj (ORCPT ); Thu, 27 Jan 2022 19:12:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238679AbiA1AMg (ORCPT ); Thu, 27 Jan 2022 19:12:36 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 210C5C061714 for ; Thu, 27 Jan 2022 16:12:36 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id o1-20020a1c4d01000000b0034d95625e1fso6995843wmh.4 for ; Thu, 27 Jan 2022 16:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=n0OsaVS4N8R3uutCBihXpyJsQg+PHu3KsqzE/4O5064=; b=VM6cVF5aTuUrLhecz+7CvqG1q150s6ugPhQX+DJVKQ4gnNSVV7kXFQ0PlHj8lL0y5j 4naXeLzNprNaX4YHHUC3forX/TU4iE3nT2x6LKPQo78V6eHsOUQOQ8yZVYt7dmn8wU0G 33OePka8ThaOLg9n6nkAz/qDmkZ/07NDXdZjeT9TlhAgjqNyrXngBwq1Ys2tCP6FDvuY 3Ix56BMIVBnzhF/AaTuksLQtvMC6NKvPFqDyJFCruODIya3XC4gRDTlc2nxnVl7TsGDM i8PFQyUxEfce8kt1AcLfbofrXbqz3PITcTAm4Tdlz2UStWeC9lj8x34bJeFBQqWdkYWL wwgA== 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=n0OsaVS4N8R3uutCBihXpyJsQg+PHu3KsqzE/4O5064=; b=hwbIpeMMBJtE3O0KU3CdHQG6H8CmpqFs3XIMz7qomAIyHhzYFhRof6c7FU3W+GREVH 6jKz8IWfkbJmrYZB2LeKKfxwcbB5RdF35vV9ySdwn4pZtmO6jd7vTfHCBVVDZch95U22 Iw10TxGPJeGLszm37q8cRnYOIEIUq4kx51H4ftaWhgHxhud95wUAfhkspeFNsapZ6Msw FRz1Rmq8bB2ZfHCJxQvJ+KzXfYfLIl7EsrMoZQrBGpRpZMoNhBGl2oY+2rvhWv8wuNs3 HA/7dVb4M/YjR/n/NoLWttJWsxjMTsOfG11p20UUSUw/CWuj17gPTbDEJQNR39RUxzxl I4Hg== X-Gm-Message-State: AOAM532h87NHlL+w059KT0X0fKrSjX36Xjqk2wM3Dk0PN2vkcxgmseXn q5gld4dcJr9uvrzV8c1w9fzh8EIBwhk= X-Google-Smtp-Source: ABdhPJzadBbRXGBTY3vnOoRo4MEBNMEmj63wHx+a2fJbN03SWmv06CZENH2BghWQzfX7j9G80PWzTQ== X-Received: by 2002:a1c:4386:: with SMTP id q128mr5110911wma.9.1643328754520; Thu, 27 Jan 2022 16:12:34 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e13sm4019252wrq.35.2022.01.27.16.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:34 -0800 (PST) Message-Id: <93d19d85ee38f50019d5f05605ce7b5eca76cbd6.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:22 +0000 Subject: [PATCH 01/11] bisect run: fix the error message Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , 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. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 28a2e6a5750..4208206af07 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1093,7 +1093,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) { int res = BISECT_OK; struct strbuf command = STRBUF_INIT; - struct strvec args = STRVEC_INIT; struct strvec run_args = STRVEC_INIT; const char *new_state; int temporary_stdout_fd, saved_stdout; @@ -1111,8 +1110,6 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) strvec_push(&run_args, command.buf); while (1) { - strvec_clear(&args); - printf(_("running %s\n"), command.buf); res = run_command_v_opt(run_args.v, RUN_USING_SHELL); @@ -1157,14 +1154,13 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) printf(_("bisect found first bad commit")); res = BISECT_OK; } else if (res) { - error(_("bisect run failed: 'git bisect--helper --bisect-state" - " %s' exited with error code %d"), args.v[0], res); + error(_("bisect run failed: 'git bisect" + " %s' exited with error code %d"), new_state, res); } else { continue; } strbuf_release(&command); - strvec_clear(&args); strvec_clear(&run_args); return res; } From patchwork Fri Jan 28 00:12:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727569 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 A3F57C433F5 for ; Fri, 28 Jan 2022 00:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344493AbiA1AMk (ORCPT ); Thu, 27 Jan 2022 19:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344449AbiA1AMh (ORCPT ); Thu, 27 Jan 2022 19:12:37 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE02C061714 for ; Thu, 27 Jan 2022 16:12:36 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id l25so7610827wrb.13 for ; Thu, 27 Jan 2022 16:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Ff2Q/b+XBBCbZWENkgo9wWyYGUXXcYV6vwClmKN88ag=; b=TSZ714fGc6H3TkXMvwsqdbz0q3XFKIWSGBlHEMxKfMrxUr5emGPgoZmc+FpfS8nfT+ jVL9cr77ZZBLgnrZpTq/K1UShWHcMVHY82Grd0iHNUrPvI1JEtUTt0iZgRhXPgdn1AIT DJZj3KXth/V/wPvFV3UOARtzGjTV6HeA35p8ZJHKEwEIrtsLOZsP1GGbWZLzNAnElVDt /HQqDw/tgnq8as9jxqpp+tI3LFYK4j5xZ9JPOKUdYKVmOTXv3dPngPL79VB98aIZVND9 hN4xqRFFxomdV8Ru/qULwNTev45Fy2Ygw1qVrtIuBAmbQpNnPZa0LWkpFAUB28sxCrAS WliQ== 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=Ff2Q/b+XBBCbZWENkgo9wWyYGUXXcYV6vwClmKN88ag=; b=PPK6CbENe/fIOYLxqkcrb3g8ydlR08JelmV06Ia8gip4hcRohVGhnFdmRBjtuoFIGN IksEyHBB/YeY0hOeoHLTCSVM18Uzfw2B6tVA4TrwkGvIv0gOoSqNOJsVxjqqcbQLmsdD wL49OGm6KWdNXb5CfH1EICtQdCLy9BoXtq7/04Bwkt9Xuy9YXp7u9FlMhngfbTp0Og2K x/OgyeUXca8gR1PE6egKPBPPtOXnWmW2hUM96dPTKZGdue9OIeM35988nIEywqi1mB5R bdC/aF60NztVRjyoiM0w8zGvtyNvh7T1Pg0cdZ8+ajoeZH4eAq0VQiEen2ozZf7JMo+5 Y21w== X-Gm-Message-State: AOAM5327yNkT+1B4OYPVS5kwzVdKp5BmV7/aMk4OVfmWCMKWjLdnce0T +S9m495WF4fiqMQLUapG7ZeyqsmetTI= X-Google-Smtp-Source: ABdhPJxZUghbgrXNWLF4tHAnhZVRCeIQc6q/yGKZdEvo8vKTQvxqM2yagg3H28A9N6CnIL7v0Z9VZw== X-Received: by 2002:a5d:65cd:: with SMTP id e13mr5025887wrw.472.1643328755303; Thu, 27 Jan 2022 16:12:35 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j12sm3246757wru.38.2022.01.27.16.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:34 -0800 (PST) Message-Id: <8e0e555998007b2625f4a99f3b800e5f4cf89e19.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:23 +0000 Subject: [PATCH 02/11] 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 , 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 4208206af07..9c8ba61dac0 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1182,7 +1182,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_VISUALIZE, BISECT_RUN, } cmdmode = 0; - int res = 0, nolog = 0; + int res = 0; struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), @@ -1206,8 +1206,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("visualize the bisection"), BISECT_VISUALIZE), OPT_CMDMODE(0, "bisect-run", &cmdmode, N_("use ... to automatically bisect."), BISECT_RUN), - OPT_BOOL(0, "no-log", &nolog, - N_("no log for BISECT_WRITE")), OPT_END() }; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; From patchwork Fri Jan 28 00:12:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727570 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 86834C4332F for ; Fri, 28 Jan 2022 00:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344506AbiA1AMl (ORCPT ); Thu, 27 Jan 2022 19:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344203AbiA1AMh (ORCPT ); Thu, 27 Jan 2022 19:12:37 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D903C06173B for ; Thu, 27 Jan 2022 16:12:37 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id o1-20020a1c4d01000000b0034d95625e1fso6995879wmh.4 for ; Thu, 27 Jan 2022 16:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=rQxd9UNl4dqkd7Hv933DGBgLXVurR9u+yuPopOgIpdI=; b=b4aSwceWDfjsdm63fdezhuANsYYnjvBB/0rMNKeJpHDhQd4DCMZC9RFhUBcLpRm57Q xZAFREqVodXwMqpsMZnAB1o9CNMJo77j3DyxO4LDBtgP4KNRHATKR1hS9DpbTw9yUVGQ 3a18DIil2TKtFltZD9n0ZjoaK6AYrrxoCknID0Lg2MhH40jQEqbstKqCo4XmPiZWjshk ZBqWlSMu+hVH8Zp+GfhWDxd+AwpvnZy0BRj7/24DbkNFRn8Yoe/Ho6J36hY6tDRXQsge n46V4JzonclgTsxFiF0vGqJ98eoS/OACuKC+BHxg26GBAVTkgTvcoIMacI9yG7eVYXkS jygw== 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=rQxd9UNl4dqkd7Hv933DGBgLXVurR9u+yuPopOgIpdI=; b=jiKfEpd3HXBDsoeNaOd8LRRF6ix0oXfGc6ivj59UMVO33L7esNJ4EWmUTm1YIwLFLP wQr6ca5Y8h+ndVNc00LHJYlp2dzQkNrGbPMYWbV6jf9+manLzRKZib5nFvJSglnShw0j 4pCkPpKSB2WaaogZsljJWMY+zivrGAqHTqPs6WgJKeLi/7vHe/+FdOEn2jfc+ZZseeTI BnXz6XSnR979RsGpYYmVPvvUEX6roelpc8plgExrRvMF1+8gm5ogPm2iyiaP/CxRIQki 4dGWnOG6WLY9CsIaLh59QesniywyoEaShdpGgdWmWtRDcv1N3BHCVnFHdwgpn8WBL6ua n3lQ== X-Gm-Message-State: AOAM533ujQfP77e+mk/eR8tDDTTDjg6T5FBoVlR0eXCVZ9LSoTHuRM1C sb6l+St+raXeAuU/tKRIu/L7fQBkSa0= X-Google-Smtp-Source: ABdhPJzzwFY8io/hBcEv1N94jkIUo8ovptIiiBP0d23LHyLCR84/koP2JVC4hBpEcpL8PSiL4W9G6A== X-Received: by 2002:a1c:730e:: with SMTP id d14mr13751382wmb.64.1643328755963; Thu, 27 Jan 2022 16:12:35 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o6sm4061181wrc.65.2022.01.27.16.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:35 -0800 (PST) Message-Id: <996a7099bf8177ac018f9f534aec04921c4ef0e0.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:24 +0000 Subject: [PATCH 03/11] 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 , 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 9c8ba61dac0..dc840736cb5 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1170,7 +1170,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { BISECT_RESET = 1, - BISECT_NEXT_CHECK, BISECT_TERMS, BISECT_START, BISECT_AUTOSTART, @@ -1186,8 +1185,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-next-check", &cmdmode, - N_("check whether bad or good terms exist"), BISECT_NEXT_CHECK), OPT_CMDMODE(0, "bisect-terms", &cmdmode, N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-start", &cmdmode, From patchwork Fri Jan 28 00:12:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727571 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 77A10C433FE for ; Fri, 28 Jan 2022 00:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344513AbiA1AMm (ORCPT ); Thu, 27 Jan 2022 19:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344469AbiA1AMi (ORCPT ); Thu, 27 Jan 2022 19:12:38 -0500 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 3F0F1C061714 for ; Thu, 27 Jan 2022 16:12:38 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id h21so7647910wrb.8 for ; Thu, 27 Jan 2022 16:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=gzUOFwJTdjbFyf+Dn8UdDY94vfUQnvj8Lr3SyjI2DqQ=; b=FzZIHrn5GMYxhEbv4bLM5Pg/16WUA2mZ9n2K/VvN5z683epL8L6TxTyF2nnmVLlv3v MElDVG99b442vuKdbebwBeqLsHZXQVnEvi6gvDy5bwHHFrqxcL9Ujakamdo1DXiiiAyv 8I/BHGUAe399QOeOXAOw3Wc9lcBNK3b4Vci8n4Q0kaG6s7xestY+RpJZwCFqrEBYtsRR kHLvd2nSEESrcDI2YrlVVYP8jMi8se19Vnh64HzKTzv9jqUcQjLwx3OFCqRu+0JUEasY tHNxLUlCWS+RCYxvw3FjoWoG5zbwYMQN9RafuDWYvq2+Vt10RqBj724Iqf6ewf+wGpih /EUQ== 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=gzUOFwJTdjbFyf+Dn8UdDY94vfUQnvj8Lr3SyjI2DqQ=; b=4D7snafEPte6F8405531jwzmhQY2W8E147Ci/kB/u89T3eZTkTtZkEIseV4FMpblv2 D5ubpnQ4gW7ETFvl08Q2JPsAT4n+LKbuSRPUwuJUl9uFv/6hfqL82kPEiouMsuRKOzvf DpSvsAam3Jjyrwivyk0/JA1yvMvFpvNI3e75HgnPQpYboBgcgZmQTXt+yoj2H5TiSQL0 T3VfNi+fLOM5GSrbUl71/CAnhYsfBGwpU4bNHNgXx64Y5moFB6RPQltWp1t1TC7M6CgL swXmwV93jxh3/qmLxqupgbYRiEH2ucAXbc6RnM+S31/YXeD/+fS08Uiw1/0TThnT55TT /5Pg== X-Gm-Message-State: AOAM530M6y5WCM1F+s0k6O2TrVTw5XLp/Rv2ONkzrB1SEZAXlCVFvkNh abIg+nFQs8gxmad6OQ2Dl1yv+iTQCt8= X-Google-Smtp-Source: ABdhPJwvWNCBpPgAaSOrRbTRGOteMz4J7wV4VKHv4BLy+NWfsbkWSX+DywM8dDg0ntaHBVq3546JhA== X-Received: by 2002:adf:ee4b:: with SMTP id w11mr5060578wro.248.1643328756715; Thu, 27 Jan 2022 16:12:36 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m29sm592644wms.34.2022.01.27.16.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:36 -0800 (PST) Message-Id: <3de4c48b66dbab7c9bff486221cfd29212cee893.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:25 +0000 Subject: [PATCH 04/11] bisect--helper: really retire `--bisect-autostart` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , 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 dc840736cb5..7ba4be1947e 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1172,7 +1172,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_RESET = 1, BISECT_TERMS, BISECT_START, - BISECT_AUTOSTART, BISECT_NEXT, BISECT_STATE, BISECT_LOG, From patchwork Fri Jan 28 00:12:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727572 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 4B12CC433F5 for ; Fri, 28 Jan 2022 00:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344517AbiA1AMn (ORCPT ); Thu, 27 Jan 2022 19:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344472AbiA1AMj (ORCPT ); Thu, 27 Jan 2022 19:12:39 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7755C061747 for ; Thu, 27 Jan 2022 16:12:38 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id l25so7610941wrb.13 for ; Thu, 27 Jan 2022 16:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=xgvZ1PEwGj+nTYvwqT5lUb33L+DTtVBe6u/LBGGglGo=; b=KVOTCntXfRArMk+h9iE5wrCF6va/NM1SOJow7q9HuhBVmfiGsVUQvJFtBv4pTPsBx0 jt/R5gp1HIVpnRjjPE7XJUqkk1Lk68JWCOSGUjLRx//yk9dWTfjChhNEmRawtw83yuf8 hqJE3QxAirxLxgv/sErHDJtedky1PXpTVq0kv7ryMlb1ZDCU63cM3LxiUMej16oBhr01 v/HImDIVBLloE4VDeCEnQEnw7N+wCLASONLGxuPEjV8lTUgCkEyob+hSiHxsuadjcP5l exv+Te2G5rUcelC5YQpPtaKEYThxWM3ihHBos5cZsCKi2K7IIRV/woVx//TlH34HCl3J tr9Q== 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=xgvZ1PEwGj+nTYvwqT5lUb33L+DTtVBe6u/LBGGglGo=; b=ENcF004vKn8HcAEwacexXvu5dbSBI0VQ1tkCTGSfmuplEiA38V3iLSfSFJTAYZj99v 0nHsiDJXv5EKm8B8JL8ZzUmaOPpglao9dILGPqrN69r3GhLEYAkA9GkvWkdlV9q0WH2V SUQKucYXEylvewARSb0rwgKFj6xR7CG+YMpTE+VbyCAAVRcnni2s/b8gnqL900vsx1D1 5Ue87DrIat7wmoXxLR2Od5bwJdyuVTAz2qQ1eioms4NDG6t2ynbUF7Q1ej4QTPPLpf8M ekg2RobrfI/L534kT4BO0v9SAz7XlWymBQHGQpvjMfMrz6N5jtN65NDopqJyaXU+9TOQ v1/w== X-Gm-Message-State: AOAM5337L8nJHFtX6BoawjkK53AODV+8wSESmukIEfKZFK3T4HT579Qq wcAEVRqkAgqlaV2WnSNP0D+07VN10D8= X-Google-Smtp-Source: ABdhPJyAoU4Pr5w5JdHO1IiJKDbfkB7kFAiacHn6OuJhyxZSbKdUgPyTpo55BCPs4MMJIfDLCQQzDA== X-Received: by 2002:adf:ee11:: with SMTP id y17mr5305374wrn.158.1643328757428; Thu, 27 Jan 2022 16:12:37 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p7sm3740982wrr.7.2022.01.27.16.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:37 -0800 (PST) Message-Id: <6afc6e0eeced94d6d5b820cc0c77cbb74d175900.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:26 +0000 Subject: [PATCH 05/11] 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 , 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 7ba4be1947e..cc5a9ca41b9 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1169,37 +1169,37 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - BISECT_RESET = 1, - BISECT_TERMS, - BISECT_START, - BISECT_NEXT, + BISECT_START = 1, BISECT_STATE, - BISECT_LOG, - BISECT_REPLAY, + BISECT_TERMS, BISECT_SKIP, + BISECT_NEXT, + BISECT_RESET, BISECT_VISUALIZE, + BISECT_REPLAY, + BISECT_LOG, BISECT_RUN, } cmdmode = 0; int res = 0; struct option options[] = { - OPT_CMDMODE(0, "bisect-reset", &cmdmode, - N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-terms", &cmdmode, - N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-start", &cmdmode, N_("start the bisect session"), BISECT_START), - OPT_CMDMODE(0, "bisect-next", &cmdmode, - N_("find the next bisection commit"), BISECT_NEXT), OPT_CMDMODE(0, "bisect-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), - OPT_CMDMODE(0, "bisect-log", &cmdmode, - N_("list the bisection steps so far"), BISECT_LOG), - OPT_CMDMODE(0, "bisect-replay", &cmdmode, - N_("replay the bisection process from the given file"), BISECT_REPLAY), + OPT_CMDMODE(0, "bisect-terms", &cmdmode, + N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-skip", &cmdmode, N_("skip some commits for checkout"), BISECT_SKIP), + OPT_CMDMODE(0, "bisect-next", &cmdmode, + N_("find the next bisection commit"), BISECT_NEXT), + OPT_CMDMODE(0, "bisect-reset", &cmdmode, + N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-visualize", &cmdmode, N_("visualize the bisection"), BISECT_VISUALIZE), + OPT_CMDMODE(0, "bisect-replay", &cmdmode, + N_("replay the bisection process from the given file"), BISECT_REPLAY), + OPT_CMDMODE(0, "bisect-log", &cmdmode, + N_("list the bisection steps so far"), BISECT_LOG), OPT_CMDMODE(0, "bisect-run", &cmdmode, N_("use ... to automatically bisect."), BISECT_RUN), OPT_END() @@ -1214,19 +1214,24 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case BISECT_RESET: - if (argc > 1) - return error(_("--bisect-reset requires either no argument or a commit")); - res = bisect_reset(argc ? argv[0] : NULL); + case BISECT_START: + set_terms(&terms, "bad", "good"); + res = bisect_start(&terms, argv, argc); + break; + case BISECT_STATE: + set_terms(&terms, "bad", "good"); + get_terms(&terms); + res = bisect_state(&terms, argv, argc); break; case BISECT_TERMS: if (argc > 1) return error(_("--bisect-terms requires 0 or 1 argument")); res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL); break; - case BISECT_START: + case BISECT_SKIP: set_terms(&terms, "bad", "good"); - res = bisect_start(&terms, argv, argc); + get_terms(&terms); + res = bisect_skip(&terms, argv, argc); break; case BISECT_NEXT: if (argc) @@ -1234,15 +1239,14 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_next(&terms, prefix); break; - case BISECT_STATE: - set_terms(&terms, "bad", "good"); - get_terms(&terms); - res = bisect_state(&terms, argv, argc); + case BISECT_RESET: + if (argc > 1) + return error(_("--bisect-reset requires either no argument or a commit")); + res = bisect_reset(argc ? argv[0] : NULL); break; - case BISECT_LOG: - if (argc) - return error(_("--bisect-log requires 0 arguments")); - res = bisect_log(); + case BISECT_VISUALIZE: + get_terms(&terms); + res = bisect_visualize(&terms, argv, argc); break; case BISECT_REPLAY: if (argc != 1) @@ -1250,14 +1254,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); break; - case BISECT_SKIP: - set_terms(&terms, "bad", "good"); - get_terms(&terms); - res = bisect_skip(&terms, argv, argc); - break; - case BISECT_VISUALIZE: - get_terms(&terms); - res = bisect_visualize(&terms, argv, argc); + case BISECT_LOG: + if (argc) + return error(_("--bisect-log requires 0 arguments")); + res = bisect_log(); break; case BISECT_RUN: if (!argc) From patchwork Fri Jan 28 00:12:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727574 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 8E25DC433FE for ; Fri, 28 Jan 2022 00:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344531AbiA1AMo (ORCPT ); Thu, 27 Jan 2022 19:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238679AbiA1AMk (ORCPT ); Thu, 27 Jan 2022 19:12:40 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B769AC061748 for ; Thu, 27 Jan 2022 16:12:39 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id e8so7785912wrc.0 for ; Thu, 27 Jan 2022 16:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=kHw3oPYgtl9TKEaskM7/b5rVUaY/eEHOcDJQMigxLHw=; b=dChvK3haIVnTnIF6GvqkR0+B3h2aPheeB28ZDuABi8C9Fgfq5OFsnPIJ7DO+mIoml5 qOP9vX877wrUyMDcuV+SxFNuwCALIEHP7YSos8VSemEXEYUn/Pr2SeNAikZk1wxX0dtV Tr7gz0IxrnYiQftDfKHgO4vFqSu91gzqp8Kme1YzzUnCeMFfKCqsWcNW6Aj01WppLOmg oVrjIDHrnQaFrZ/2/FwgxR1HCvBzUYMhWKYBoEnwPrm80NyFNFe5PP27w+LWW0jefBUN X3MnPHv/J3+o1Tu6DEVT0u8RiaRCKfPm/ZPAvUa8/FGWBJQjx3t1vZEeNRaZ3flQfJkU pjhQ== 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=kHw3oPYgtl9TKEaskM7/b5rVUaY/eEHOcDJQMigxLHw=; b=W+pFredwhHEsBkx4SWsx7VWDDgRfM0H4lMN0yh7CzB0F3eUh9UZjYK9oTG6oKKFlQQ 4L1SBbxAiouixOnW2TJWStEjrAqJK7zR0kBGh7ndf6/6o3iv5kI1AxWFH69AiugczWbl zXAMjkoLfHjMdfUiEl46kp3oeYFjZYyLswq4wfnpnBOpB/eNFNlzt8yW6hFErFfhENNh BDNnX4lZ5yQsAU1zpFerj+ZrHGR8z6H64kr/JM9Cmbk5nZR60MIed04Zwo//qEAuxdxq Cl/PdiGAzSGtXVT9Eq9TlmxjHgBTWeQMsp63zjZ8pEcrfflDpOfCqpGLIQVjXcyO+ooQ MM2A== X-Gm-Message-State: AOAM533nK6tS+mvzXug+xlToWTpYHuEHZpK7UrZeStWJelCTBNaCjEp2 aSl7dJU2xKJdwYZdmx287PYuXCXJhto= X-Google-Smtp-Source: ABdhPJzA15ErKybqOS2Gd393gvS3JEccko/3fCmQyucTdgYATMm0nER8ob74r+aXipdzjcBSpLUJxQ== X-Received: by 2002:a5d:6e88:: with SMTP id k8mr4802121wrz.384.1643328758183; Thu, 27 Jan 2022 16:12:38 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e17sm564417wme.29.2022.01.27.16.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:37 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:27 +0000 Subject: [PATCH 06/11] bisect--helper: make `--bisect-state` optional Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , 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. To prepare for converting `bisect--helper` to a full built-in implementation of `git bisect` (which must not require the `--bisect-state` option to be specified at all), let's move the handling toward the end of the `switch (cmdmode)` block. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index cc5a9ca41b9..219fa99cd0b 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -26,8 +26,8 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" " [--no-checkout] [--first-parent] [ [...]] [--] [...]"), N_("git bisect--helper --bisect-next"), - N_("git bisect--helper --bisect-state (bad|new) []"), - N_("git bisect--helper --bisect-state (good|old) [...]"), + N_("git bisect--helper [--bisect-state] (bad|new) []"), + N_("git bisect--helper [--bisect-state] (good|old) [...]"), N_("git bisect--helper --bisect-replay "), N_("git bisect--helper --bisect-skip [(|)...]"), N_("git bisect--helper --bisect-visualize"), @@ -1210,6 +1210,13 @@ 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 && argc > 0) { + set_terms(&terms, "bad", "good"); + get_terms(&terms); + if (!check_and_set_terms(&terms, argv[0])) + cmdmode = BISECT_STATE; + } + if (!cmdmode) usage_with_options(git_bisect_helper_usage, options); @@ -1218,11 +1225,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); - res = bisect_state(&terms, argv, argc); - break; case BISECT_TERMS: if (argc > 1) return error(_("--bisect-terms requires 0 or 1 argument")); @@ -1265,6 +1267,13 @@ 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: + if (!terms.term_good) { + set_terms(&terms, "bad", "good"); + get_terms(&terms); + } + res = bisect_state(&terms, argv, argc); + break; default: BUG("unknown subcommand %d", cmdmode); } From patchwork Fri Jan 28 00:12:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727577 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 156B2C433EF for ; Fri, 28 Jan 2022 00:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344555AbiA1AMp (ORCPT ); Thu, 27 Jan 2022 19:12:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344498AbiA1AMl (ORCPT ); Thu, 27 Jan 2022 19:12:41 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9991EC06173B for ; Thu, 27 Jan 2022 16:12:40 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id q9-20020a7bce89000000b00349e697f2fbso7037251wmj.0 for ; Thu, 27 Jan 2022 16:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Jt99SVPjrm6dYMEkAoDnOZORP+udyvsiw8E8i08g75U=; b=TAXSmZ01HkiAsU9xOVG+ew0lCssG0cgjwD7LfppylZ7THd1bvHPyvT8gdkuBtBSKzT VG9zoz184s2CWQrl48ElN0a9XYSnFkXW/slzWoC07wIVagCEkhgueeYyLWQQb2y3w2s1 KaumUtEIrdvpvE0za2Qi7iLBDDAvwI0NlhBEDNhgYjRMkP9y1UID5xuEYAhXVpfZqv1s vYRPQ5RT1aWyq73dKaOev2QjjE+BIqI8p/6LY5kTXxaX8wJZ/3h0Q89M+aQFObwdHtAl cZZ8bPoJkjLh0ax+tjzbsxfdBx/dwQRCz5yXSPPReC4nKFj46bs7hXWtFJy5+aN7Rkmh SmiA== 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=Jt99SVPjrm6dYMEkAoDnOZORP+udyvsiw8E8i08g75U=; b=K350daJh+KzXyDulk32d3Ds7vTv25h7gP1+O6Xe9qwBPvSJYbQbtv+eBI/Rf9t4vXk Ed6MxDGeazhQlX4p3l5JRffwiO3M/tkVahcyjUcGOVGdGoAJDogVEexfYzmXA0p/bvBS +KCJesYu57VybjQL5g05AtG+p0qyvyRB89Rfzwckd+lf56KooqHG4pc0Awkpnp36XdoQ GJdb2IlUmenAk1i062erjb0dnOavH57LloveRDA4ZwO0suDn26omGNjjYZMbFvCXtqfD OhrXdBhzjnqqDI6t37gq4TM71L+szpIuvtWg9ryF4OAvg7IkdEdKUeM0xMCOJdxJ1O67 Z0qg== X-Gm-Message-State: AOAM530+EgWEEnFTfpJ0m1Ejchvh9Fx/XZ/gtRPciKOtRUffUe9iVcWq PP98Ez1/O4YAMXT/8RWtQSmULvMoCFs= X-Google-Smtp-Source: ABdhPJyABV/pJqDkPpiebWqnIMdNyKKtvvEybxPtBOaCYTP+QFEO64e4xvX9M/PcZXwJJafkx8p9eQ== X-Received: by 2002:a05:600c:3d8a:: with SMTP id bi10mr5295294wmb.62.1643328758918; Thu, 27 Jan 2022 16:12:38 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y14sm3901351wrd.91.2022.01.27.16.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:38 -0800 (PST) Message-Id: <515e86e20758ed7f5b4a8ce8f38bfbbac27ec42a.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:28 +0000 Subject: [PATCH 07/11] bisect: move even the option parsing to `bisect--helper` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin On our journey to a fully built-in `git bisect`, this is the second-to-last step. Side note: The `if (!strcmp(...)) ... else if (!strcmp(...)) ... else if (!strcmp(...)) ...` chain seen in this patch was not actually the first idea how to convert the command modes to sub-commands. Since the `bisect--helper` command already used the `parse-opions` API with neatly set-up command modes, naturally the idea was to use `PARSE_OPT_NODASH` to support proper sub-commands instead. However, the `parse-options` API is not set up for that, and even after making that option work with long options, it turned out that `STOP_AT_NON_OPTION` and `KEEP_UNKNOWN` would have to be used but these options were not designed to work together. So it would appear as if a lot of work would have to be done just to be able to use `parse_options()` just to parse the sub-command, instead of a simple `if...else if` chain, the latter being a dramatically simpler implementation. Therefore, we now keep the `parse_options()` call primarily to support `-h` and little else. Signed-off-by: Johannes Schindelin --- builtin/bisect--helper.c | 172 ++++++++++++++++----------------------- git-bisect.sh | 49 +---------- 2 files changed, 72 insertions(+), 149 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 219fa99cd0b..4450305c81c 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,18 +20,34 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN") -static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --bisect-reset []"), - N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), - N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" - " [--no-checkout] [--first-parent] [ [...]] [--] [...]"), - N_("git bisect--helper --bisect-next"), - N_("git bisect--helper [--bisect-state] (bad|new) []"), - N_("git bisect--helper [--bisect-state] (good|old) [...]"), - N_("git bisect--helper --bisect-replay "), - N_("git bisect--helper --bisect-skip [(|)...]"), - N_("git bisect--helper --bisect-visualize"), - N_("git bisect--helper --bisect-run ..."), +static const char * const git_bisect_usage[] = { + N_("git bisect help\n" + "\tprint this long help message."), + N_("git bisect start [--term-{new,bad}= --term-{old,good}=]\n" + "\t\t [--no-checkout] [--first-parent] [ [...]] [--] [...]\n" + "\treset bisect state and start bisection."), + N_("git bisect (bad|new) []\n" + "\tmark a known-bad revision/\n" + "\t\ta revision after change in a given property."), + N_("git bisect (good|old) [...]\n" + "\tmark ... known-good revisions/\n" + "\t\trevisions before change in a given property."), + N_("git bisect terms [--term-good | --term-bad]\n" + "\tshow the terms used for old and new commits (default: bad, good)"), + N_("git bisect skip [(|)...]\n" + "\tmark ... untestable revisions."), + N_("git bisect next\n" + "\tfind next bisection to test and check it out."), + N_("git bisect reset []\n" + "\tfinish bisection search and go back to commit."), + N_("git bisect (visualize|view)\n" + "\tshow bisect status in gitk."), + N_("git bisect replay \n" + "\treplay bisection log."), + N_("git bisect log\n" + "\tshow bisect log."), + N_("git bisect run ...\n" + "\tuse ... to automatically bisect."), NULL }; @@ -1168,115 +1184,69 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { - enum { - BISECT_START = 1, - BISECT_STATE, - BISECT_TERMS, - BISECT_SKIP, - BISECT_NEXT, - BISECT_RESET, - BISECT_VISUALIZE, - BISECT_REPLAY, - BISECT_LOG, - BISECT_RUN, - } cmdmode = 0; int res = 0; struct option options[] = { - OPT_CMDMODE(0, "bisect-start", &cmdmode, - N_("start the bisect session"), BISECT_START), - OPT_CMDMODE(0, "bisect-state", &cmdmode, - N_("mark the state of ref (or refs)"), BISECT_STATE), - OPT_CMDMODE(0, "bisect-terms", &cmdmode, - N_("print out the bisect terms"), BISECT_TERMS), - OPT_CMDMODE(0, "bisect-skip", &cmdmode, - N_("skip some commits for checkout"), BISECT_SKIP), - OPT_CMDMODE(0, "bisect-next", &cmdmode, - N_("find the next bisection commit"), BISECT_NEXT), - OPT_CMDMODE(0, "bisect-reset", &cmdmode, - N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-visualize", &cmdmode, - N_("visualize the bisection"), BISECT_VISUALIZE), - OPT_CMDMODE(0, "bisect-replay", &cmdmode, - N_("replay the bisection process from the given file"), BISECT_REPLAY), - OPT_CMDMODE(0, "bisect-log", &cmdmode, - N_("list the bisection steps so far"), BISECT_LOG), - OPT_CMDMODE(0, "bisect-run", &cmdmode, - N_("use ... to automatically bisect."), BISECT_RUN), OPT_END() }; struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL }; + const char *command = argc > 1 ? argv[1] : "help"; - argc = parse_options(argc, argv, prefix, options, - git_bisect_helper_usage, - PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN); + /* Handle -h and invalid options */ + parse_options(argc - 1, argv + 1, prefix, options, + git_bisect_usage, + PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN | + PARSE_OPT_ONE_SHOT | PARSE_OPT_STOP_AT_NON_OPTION); - if (!cmdmode && argc > 0) { + if (!strcmp("help", command)) + usage_with_options(git_bisect_usage, options); + else if (!strcmp("start", command)) { set_terms(&terms, "bad", "good"); - get_terms(&terms); - if (!check_and_set_terms(&terms, argv[0])) - cmdmode = BISECT_STATE; - } - - if (!cmdmode) - usage_with_options(git_bisect_helper_usage, options); - - switch (cmdmode) { - case BISECT_START: - set_terms(&terms, "bad", "good"); - res = bisect_start(&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_SKIP: + res = bisect_start(&terms, argv + 2, argc - 2); + } else if (!strcmp("terms", command)) { + if (argc > 3) + return error(_("'terms' requires 0 or 1 argument")); + res = bisect_terms(&terms, argc == 3 ? argv[2] : NULL); + } else if (!strcmp("skip", command)) { set_terms(&terms, "bad", "good"); get_terms(&terms); - res = bisect_skip(&terms, argv, argc); - break; - case BISECT_NEXT: - if (argc) - return error(_("--bisect-next requires 0 arguments")); + res = bisect_skip(&terms, argv + 2, argc - 2); + } else if (!strcmp("next", command)) { + if (argc != 2) + return error(_("'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")); - res = bisect_reset(argc ? argv[0] : NULL); - break; - case BISECT_VISUALIZE: + } else if (!strcmp("reset", command)) { + if (argc > 3) + return error(_("'reset' requires either no argument or a commit")); + res = bisect_reset(argc > 2 ? argv[2] : NULL); + } else if (one_of(command, "visualize", "view", NULL)) { get_terms(&terms); - res = bisect_visualize(&terms, argv, argc); - break; - case BISECT_REPLAY: - if (argc != 1) + res = bisect_visualize(&terms, argv + 2, argc - 2); + } else if (!strcmp("replay", command)) { + if (argc != 3) return error(_("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")); + res = bisect_replay(&terms, argv[2]); + } else if (!strcmp("log", command)) { + if (argc > 2) + return error(_("'log' requires 0 arguments")); res = bisect_log(); - break; - case BISECT_RUN: - if (!argc) + } else if (!strcmp("run", command)) { + if (argc < 3) return error(_("bisect run failed: no command provided.")); get_terms(&terms); - res = bisect_run(&terms, argv, argc); - break; - case BISECT_STATE: - if (!terms.term_good) { - set_terms(&terms, "bad", "good"); - get_terms(&terms); + res = bisect_run(&terms, argv + 2, argc - 2); + } else { + set_terms(&terms, "bad", "good"); + get_terms(&terms); + if (!check_and_set_terms(&terms, command)) + res = bisect_state(&terms, argv + 1, argc - 1); + else { + char *msg = xstrfmt(_("unknown command: '%s'"), command); + usage_msg_opt(msg, git_bisect_usage, options); } - 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 405cf76f2a3..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 --bisect-state "$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 Fri Jan 28 00:12:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727573 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 A53FAC433EF for ; Fri, 28 Jan 2022 00:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344573AbiA1AMq (ORCPT ); Thu, 27 Jan 2022 19:12:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344501AbiA1AMl (ORCPT ); Thu, 27 Jan 2022 19:12:41 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFD1C061747 for ; Thu, 27 Jan 2022 16:12:41 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id v13so7642090wrv.10 for ; Thu, 27 Jan 2022 16:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=6t4zwA2s9MdWvpmCtWClF0zdY8OAi7qhJLIO4F/BgO4=; b=Cgo63HZHm1EgzqmvwWYahnHWFXuNcpgix9W/xSQWY3xkhztM+yEsKL0hgr+sNLEPgp dapaKTf1NiJkBX3xeeS2PxmNJ22mRukAboP5Q/bAqhqA9Ikgnx6mKTIY7EfIKl0aunWP CwDdpKFHvVHAr/STmdbKP1kxjEPZMys7l05ZxfRnc5qgcot3ynLGNc3lkSq6zdEuCSN8 leHpwCfVm1jLa0vq4B973oTcxkKlGnozqY5D22U/jnfX6cQAXkSNfcMmXxxKcdceuEZx J7LryWxZPOr6h11VUJAF/o5CKgZY3VsdtFvwRCo42tWJhThE2eeStM4VANivrFe7aecN LZqA== 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=6t4zwA2s9MdWvpmCtWClF0zdY8OAi7qhJLIO4F/BgO4=; b=OPSzQnlo2qiG4wCkQYOUmgdUp0CidkkkCYx7OrH85mL5BoVX/rPng1H/fQlqp4w4zC +KTVXM7P8cXNEnSUwjdL5pBhnsDm4tOGTl/R3qlRKXOTXwxXu6UhbAuZdO31v7/Gs3rM EoYlPm6k3F/MofHMhTox69QfHHCr5ddLL0ymWHzAFTB6PueFki8CYvFz/gifb1FzQs2w 8DkbzvQrAyrwwEX4AvUOCSh3yGuVY9SH6UamK6IzlTWMZRDSBs1RX6E0ByGwopo2SBjc qXa0dpKKfQnFDAMSX97KEFqeDMiznjcEJLfDYzXUYZqpOqI/q1LLT9JjOsUOJy2Ocdtq lZig== X-Gm-Message-State: AOAM532qrBC2pifYbFugHWppQbZG1nBHPe1IQjwYAfnB9vtgWT4Kiiv/ L90dBN7hQhSzZMx02TzjTVJrC7SFdw8= X-Google-Smtp-Source: ABdhPJy4HCWEI1C8xbczfPfnrdX3rOC4LXJbYB4B58H5HTiwelOvIZYaFmwY/bkSw4mBYsBtUsJs6A== X-Received: by 2002:a5d:6488:: with SMTP id o8mr4934027wri.206.1643328759643; Thu, 27 Jan 2022 16:12:39 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i3sm3297247wru.33.2022.01.27.16.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:39 -0800 (PST) Message-Id: <1b14ed3d7976b8fe4149822dcbb32343e0554a38.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:29 +0000 Subject: [PATCH 08/11] 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 , 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 4450305c81c..009c919a989 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -872,7 +872,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 Fri Jan 28 00:12:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727575 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 9960CC4332F for ; Fri, 28 Jan 2022 00:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344532AbiA1AMt (ORCPT ); Thu, 27 Jan 2022 19:12:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344507AbiA1AMm (ORCPT ); Thu, 27 Jan 2022 19:12:42 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB268C061714 for ; Thu, 27 Jan 2022 16:12:41 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id l35-20020a05600c1d2300b0034d477271c1so2898276wms.3 for ; Thu, 27 Jan 2022 16:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=mdwYbmfpxXxQWqIxnJnhMQt2vU29GH/o224FSkBRs0w=; b=ISWeK6N52PhQ2NPqV0iJwc0dyJWu1PdTih/2YM9HZM3gzQWsGBCTLB9XeuvcpRLtW4 ucJ1NAsnNbcOJMJM04kChBiwIbZxjP7w1rMKJN7IyFbrnVN8tKMKaA1wxyIYBrTgtlfk 962D3tCipEsd9nj+tTZStmlvahs+WAi/9Z5opQHP2+PtAg4bnvibHus2nDcNW89ZErzK BFiKJb2Dv0fD3i3YoRVh+T9x7neHuqABXjpT3OuevmfVyerUUyhv62x02Sd5/5f3+pPo T2hXkKZy+JGZuTZAfLHrRNCiA/vLAOUAfnAHyFY8O7SNUGPbZ0Cpgskze7vCbJpALhya XfiA== 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=mdwYbmfpxXxQWqIxnJnhMQt2vU29GH/o224FSkBRs0w=; b=p29SV481j47/w8KdhDBTIFx/SMaMmoBW2MWFTEFB3wde3wVqPK3ZWiLofsr0NHVlJq 8aUrYztVvIbAJuBTCkUwRcJpuRmu1jrr+5I9doOQOxftKSAJAxkDrJHGg2nj4vWTy2OM TTeyIycV11u50uWXp6tys1xcXWeNwiEaXUZXgtVlB6MLpbYGmQBRDjXWXofhF3fi/wTM RdNzKx6TY1l5NvXygWNURdAx6YTjJMxloIPC5623W8NeHNUTkjC71mft0RaJoJJvIrwV abX9UvGqLzhpS3N9glxGOOFoRGFhoJK6ltYq4+GqEnbCfRY4vbRnxNmUYzor6sfXqI+w 8XgQ== X-Gm-Message-State: AOAM530cWf+BalN5hjAtEXEtVzWn0ntvFDwEo8o7pnQZQ37Qn/7zyf4r L6d1aLodh2p3gIYD00JDMDpiaePitLw= X-Google-Smtp-Source: ABdhPJxV/Jt+7JMTQm42jsWSYAW+ehMI7cGX5vWaeCc5rpnzSaxmF4bjOsNhsFc5erK6PEZQm4PZyQ== X-Received: by 2002:a05:600c:4f84:: with SMTP id n4mr5251653wmq.106.1643328760328; Thu, 27 Jan 2022 16:12:40 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f10sm672316wmg.36.2022.01.27.16.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:39 -0800 (PST) Message-Id: <1c0bd8a326f482d1a6c485b7f93f510268dade20.1643328752.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:30 +0000 Subject: [PATCH 09/11] 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 , 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 5580859afdb..ce2eabeca58 100644 --- a/Makefile +++ b/Makefile @@ -595,7 +595,6 @@ THIRD_PARTY_SOURCES = # interactive shell sessions without exporting it. unexport CDPATH -SCRIPT_SH += git-bisect.sh SCRIPT_SH += git-difftool--helper.sh SCRIPT_SH += git-filter-branch.sh SCRIPT_SH += git-merge-octopus.sh @@ -1064,7 +1063,7 @@ BUILTIN_OBJS += builtin/am.o BUILTIN_OBJS += builtin/annotate.o BUILTIN_OBJS += builtin/apply.o BUILTIN_OBJS += builtin/archive.o -BUILTIN_OBJS += builtin/bisect--helper.o +BUILTIN_OBJS += builtin/bisect.o BUILTIN_OBJS += builtin/blame.o BUILTIN_OBJS += builtin/branch.o BUILTIN_OBJS += builtin/bugreport.o diff --git a/builtin.h b/builtin.h index 8a58743ed63..b5567ea3a9d 100644 --- a/builtin.h +++ b/builtin.h @@ -116,7 +116,7 @@ int cmd_am(int argc, const char **argv, const char *prefix); int cmd_annotate(int argc, const char **argv, const char *prefix); int cmd_apply(int argc, const char **argv, const char *prefix); int cmd_archive(int argc, const char **argv, const char *prefix); -int cmd_bisect__helper(int argc, const char **argv, const char *prefix); +int cmd_bisect(int argc, const char **argv, const char *prefix); int cmd_blame(int argc, const char **argv, const char *prefix); int cmd_branch(int argc, const char **argv, const char *prefix); int cmd_bugreport(int argc, const char **argv, const char *prefix); diff --git a/builtin/bisect--helper.c b/builtin/bisect.c similarity index 99% rename from builtin/bisect--helper.c rename to builtin/bisect.c index 009c919a989..189aca9dd22 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect.c @@ -1182,7 +1182,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc) } } -int cmd_bisect__helper(int argc, const char **argv, const char *prefix) +int cmd_bisect(int argc, const char **argv, const char *prefix) { int res = 0; struct option options[] = { diff --git a/git-bisect.sh b/git-bisect.sh deleted file mode 100755 index 028d39cd9ce..00000000000 --- a/git-bisect.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -USAGE='[help|start|bad|good|new|old|terms|skip|next|reset|visualize|view|replay|log|run]' -LONG_USAGE='git bisect help - print this long help message. -git bisect start [--term-{new,bad}= --term-{old,good}=] - [--no-checkout] [--first-parent] [ [...]] [--] [...] - reset bisect state and start bisection. -git bisect (bad|new) [] - mark a known-bad revision/ - a revision after change in a given property. -git bisect (good|old) [...] - mark ... known-good revisions/ - revisions before change in a given property. -git bisect terms [--term-good | --term-bad] - show the terms used for old and new commits (default: bad, good) -git bisect skip [(|)...] - mark ... untestable revisions. -git bisect next - find next bisection to test and check it out. -git bisect reset [] - finish bisection search and go back to commit. -git bisect (visualize|view) - show bisect status in gitk. -git bisect replay - replay bisection log. -git bisect log - show bisect log. -git bisect run ... - use ... to automatically bisect. - -Please use "git help bisect" to get the full man page.' - -OPTIONS_SPEC= -. git-sh-setup - -exec git bisect--helper "$@" diff --git a/git.c b/git.c index edda922ce6d..a8500132a28 100644 --- a/git.c +++ b/git.c @@ -490,7 +490,7 @@ static struct cmd_struct commands[] = { { "annotate", cmd_annotate, RUN_SETUP | NO_PARSEOPT }, { "apply", cmd_apply, RUN_SETUP_GENTLY }, { "archive", cmd_archive, RUN_SETUP_GENTLY }, - { "bisect--helper", cmd_bisect__helper, RUN_SETUP }, + { "bisect", cmd_bisect, RUN_SETUP }, { "blame", cmd_blame, RUN_SETUP }, { "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG }, { "bugreport", cmd_bugreport, RUN_SETUP_GENTLY }, From patchwork Fri Jan 28 00:12:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727579 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 4C6B7C433EF for ; Fri, 28 Jan 2022 00:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238679AbiA1ANr (ORCPT ); Thu, 27 Jan 2022 19:13:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344533AbiA1AMp (ORCPT ); Thu, 27 Jan 2022 19:12:45 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95750C06174A for ; Thu, 27 Jan 2022 16:12:42 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id k18so7628740wrg.11 for ; Thu, 27 Jan 2022 16:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=IhRGnF3vALkFNHEgMh8q1KvnYK5d8RbyupwCS7Cy+5s=; b=bIk8Eft81znFBha/ZXFhisYK6huoEk6+ioq78MR5xngOpp+nVqbu81vuDpGnwnUt/F P1zBTaZd7IDoiDUK3BCWYj7yjQOFIj0iRLnL6+6YMNA5jW5yuIWqcIqfooc7NhsrKYKs hlBCJFQNx3P3XBrbrH6yzu32Omut3HkOliHIiOXRo9QqYYkXi+MFlp85M/f7xYDFc0KG y7Z/lx3t35WAY3diJYajwq7duduWI3HcQ95xnPTsjcuSmbNd++7PJjQpF3yyh2iYEJwH EP3VyFSBuxwpoHFYd4enWejQaPqnUy2wr0rOzeWz9dhQp5Sosv1zVo24m8DYhnkI0PeO 8FAQ== 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=IhRGnF3vALkFNHEgMh8q1KvnYK5d8RbyupwCS7Cy+5s=; b=CHtNPpkwefU85Az6peQ0W8t6pRzW5jCYO89s3Bw+ipMIPgPshUsmuL6pZUi3uheVsG JFZJG4XDZtMfO/5lxUsqH6hyYu7EsG68QrXlt+Om0SE6Cqa+twdbJv2IZCXfzvzPsm8L aiG1I3YCKMPhd0SQ2rks+8lzRJkZrOyoD4u5dw//fKnCPOiMo4G0JxJhCEDb7pbiJ1Vc WKy2+Ij552NIwqBWiNJ7baoHg44WDfsW4nGVHgXxH51tPJSD2eQ5A3dc6HRgvIgpcFHI 50lXtAtV4HhxR3cPl8LqvR4m4vRxQcW9DPIohcdMXX9qaguZboO8BfQahYVp+TZ73j7M P0uQ== X-Gm-Message-State: AOAM531ov/BTNuRuJc9SPfILz6NgPSmZCgHauK+nicEZOH7i0JNZzDX5 4st5bIKx1Po5uNZyVKJKh4WlTADNAgQ= X-Google-Smtp-Source: ABdhPJw4pc6VhAV2pScpWTJcp9l9+OH7bQK6otrmbgQpeOHKmDEu1b4o220fzdObJ0Z7HFZ2B6puww== X-Received: by 2002:adf:f291:: with SMTP id k17mr4745434wro.623.1643328761098; Thu, 27 Jan 2022 16:12:41 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n14sm3493016wri.80.2022.01.27.16.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:40 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:31 +0000 Subject: [PATCH 10/11] bisect: remove Cogito-related code Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Pranit Bauva , Tanushree Tumane , Miriam Rubio , 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 189aca9dd22..479d68dd3b5 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -15,7 +15,6 @@ static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK") static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") -static GIT_PATH_FUNC(git_path_head_name, "head-name") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN") @@ -756,13 +755,6 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a strbuf_addstr(&start_head, oid_to_hex(&head_oid)); } else if (!get_oid(head, &head_oid) && skip_prefix(head, "refs/heads/", &head)) { - /* - * This error message should only be triggered by - * cogito usage, and cogito users should understand - * it relates to cg-seek. - */ - if (!is_empty_or_missing_file(git_path_head_name())) - return error(_("won't bisect on cg-seek'ed tree")); strbuf_addstr(&start_head, head); } else { return error(_("bad HEAD - strange symbolic ref")); From patchwork Fri Jan 28 00:12:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12727578 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 B52FBC433F5 for ; Fri, 28 Jan 2022 00:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235341AbiA1ANq (ORCPT ); Thu, 27 Jan 2022 19:13:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344537AbiA1AMp (ORCPT ); Thu, 27 Jan 2022 19:12:45 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67C96C061756 for ; Thu, 27 Jan 2022 16:12:43 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id h21so7648204wrb.8 for ; Thu, 27 Jan 2022 16:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=R5kIPpI1IVduCOF4U9IiXs2MRkltUuc73PAiD4gWMus=; b=EOO2Zmv0eydrqO28jZI215MKDZB2Y/SgnOSS71swlJQ1dZxeEkkM4XSo8PmoWbv202 hRFczZoxhLiQopaSivpDoVVIEwyevsRN0lWPr4xuWsuwwJwJn4+86CCESwqCevF6j8fn YoP2QKl/da6aoVuQ4wETFsbI7RSxFEaIijALc3IF7ZXrw7UvPuFQMia52OyZobiELWdB wYJgdHB7bxQUoi/mQWfNQPBwyHgRosYQ2GXaDuSBGU+vUi6Bzm082YL7V9HpQhm2uSNm wyBOgYw2IRd7rXmAvkkn3KODZcTWVC0eWe4BvXdk4JnQeC0onSS5+/SvRAHmz9OaJKbE 4V7A== 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=R5kIPpI1IVduCOF4U9IiXs2MRkltUuc73PAiD4gWMus=; b=xUoVy67HnzKr1BBjWlUBY1biTBN4Z710CnE2pbnmSWM9/Loousml+jm2jL5k7h7U7k 8gK4q5QiUmgkNHhVaSETOfsEL7zOLPGHP/iMpbJKc5yfNi67x/tG4oasYh2pU2ZKbVZo 9kEEeIOLmBopLlBD+PKTPkmhQ1gnK1XUpZ2nQxYSkZnQTeH8kQXN1rhglKSlagkj6Z8F sf45ycrwPaNhTuit5qD/KITrY4DP1RVIfHjdmpbWHHQwg7I2GJeOslICdcbMgy4A/ENd NJIhgBOsmPGZTGcbm0NXy66mfP/ERrQGTGa3BTSagiOc3Md+2IxqdGeHF1RbcySNthZ7 VENA== X-Gm-Message-State: AOAM530IdED+B/z0KHqpSR4Trrfzx2IA9O70rq3BeUksHSnsfCptaewg rQc9Q6UctV8sTpAHzvmAFYKRMgD5oCc= X-Google-Smtp-Source: ABdhPJwHbDvdp2EVAZ+f35UIZsmHmC2jro8q2aHdoGY9Xa1w5JoNtF/6jacmHiIO430xDX3oIA4s/A== X-Received: by 2002:adf:a3dd:: with SMTP id m29mr4779465wrb.129.1643328761823; Thu, 27 Jan 2022 16:12:41 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m8sm3114761wrn.106.2022.01.27.16.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 16:12:41 -0800 (PST) Message-Id: In-Reply-To: References: Date: Fri, 28 Jan 2022 00:12:32 +0000 Subject: [PATCH 11/11] 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 , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin As per the code comment, the `.git/head-name` files were cleaned up for backwards-compatibility: an old version of `git bisect` could have left them behind. Now, just how old would such a version be? As of 0f497e75f05 (Eliminate confusing "won't bisect on seeked tree" failure, 2008-02-23), `git bisect` does not write that file anymore. Which corresponds to Git v1.5.4.4. Even if the likelihood is non-nil that there might still be users out there who use such an old version to start a bisection, but then decide to continue bisecting with a current Git version, it is highly improbable. So let's remove that code, at long last. Signed-off-by: Johannes Schindelin --- bisect.c | 3 --- t/t6030-bisect-porcelain.sh | 1 - 2 files changed, 4 deletions(-) diff --git a/bisect.c b/bisect.c index 888949fba6b..ebd4287c01c 100644 --- a/bisect.c +++ b/bisect.c @@ -474,7 +474,6 @@ static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START") static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG") static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") -static GIT_PATH_FUNC(git_path_head_name, "head-name") static void read_bisect_paths(struct strvec *array) { @@ -1172,8 +1171,6 @@ int bisect_clean_state(void) unlink_or_warn(git_path_bisect_run()); unlink_or_warn(git_path_bisect_terms()); unlink_or_warn(git_path_bisect_first_parent()); - /* Cleanup head-name if it got left by an old version of git-bisect */ - unlink_or_warn(git_path_head_name()); /* * Cleanup BISECT_START last to support the --no-checkout option * introduced in the commit 4796e823a. diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 1be85d064e7..7f7ee42a7f4 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -945,7 +945,6 @@ test_expect_success 'git bisect reset cleans bisection state properly' ' test_path_is_missing ".git/BISECT_LOG" && test_path_is_missing ".git/BISECT_RUN" && test_path_is_missing ".git/BISECT_TERMS" && - test_path_is_missing ".git/head-name" && test_path_is_missing ".git/BISECT_HEAD" && test_path_is_missing ".git/BISECT_START" '