From patchwork Wed Jul 1 13:34:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636405 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF9EC912 for ; Wed, 1 Jul 2020 13:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B927E207D0 for ; Wed, 1 Jul 2020 13:35:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SBjmmP0v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731064AbgGANfd (ORCPT ); Wed, 1 Jul 2020 09:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730569AbgGANfd (ORCPT ); Wed, 1 Jul 2020 09:35:33 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95AE4C08C5C1 for ; Wed, 1 Jul 2020 06:35:32 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id b6so23835823wrs.11 for ; Wed, 01 Jul 2020 06:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QGmK/o5MGnE7qfNy6OlJiuoXu3XIcEOXYJElqWDicLk=; b=SBjmmP0vha/ZYpjmX2q+udesPCfaUSZfcjYPEuAhcVrHU1DZHMj4KghmbMYi+TCP5/ VAd98v7GoILN7UYDUR9zie835WIpAONhniqkjJubhx4wB/DdjKRt5BADkGa8ftNEnOgJ cenvzj/tEuejYAo692BbQ/S1z2Xer42+W3wJ7n9CPe7bVpnYq4EPhqXjatJizzehsPD0 XIeN2H9YQkQoW9+Ki68JUPrUoghLOvsbeKmDxA6CSRHgPba/QwXbntePcZuLSbVf6HYB LviT0tzOcopr/JdZJxiuhYNNtwkQ08Y9tIqMxFaK6wr19j/4MKnJ+mtrckCzu9qhFX/D lkMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QGmK/o5MGnE7qfNy6OlJiuoXu3XIcEOXYJElqWDicLk=; b=jkPk1gO6nWEDQOKuOwXugntkUGRblBlLjBUTdzY90jozleDcfQ76T2pn/L9a52k7FJ SE0NYQiAMDgN2G7fgsepuJA/DeJQ4biLO7xwxAMVw3RyetDUL5UqoKQuL/ShlT2bX9kC nKt3tCLHqmsBqKEXX1T/CRgzvmn54aG/5BhNVm/q4WbsFBwtAt7UTcT2XdkAvBSsVUQz WGNid0Jjptk8iWQ6YwVryY1qroD9OuhIXNDMPyU99tBzYyHV0VKU1gaWPaTYe9kZhHyq TTJ2MSetVU1K7+fTBWibn7WZiy5ClVxaQVkm2nBauo90EYCCA1OQhP7pSlqeE5OHmRdz ayWg== X-Gm-Message-State: AOAM530XFrasVi7oLa5lfQ4FNK8zXLiJvJzdweqQz1JHLTupbe2uebaG A2UGVgjYthgYnuTZa7uPDfk7+l+O+M0= X-Google-Smtp-Source: ABdhPJxctBAVRVUT7zP/NRxSl7090rV6+mOwRpUlizyyaScx5EzCgGP22mTpe+hVZX+Djkh4koBm2Q== X-Received: by 2002:a05:6000:1cf:: with SMTP id t15mr28951795wrx.180.1593610531128; Wed, 01 Jul 2020 06:35:31 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:30 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH v4 01/13] bisect--helper: BUG() in cmd_*() on invalid subcommand Date: Wed, 1 Jul 2020 15:34:52 +0200 Message-Id: <20200701133504.18360-2-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In cmd_bisect__helper() function, there would be a bug if an invalid or no subcommand was passed.return error() should be replaced by BUG() in that case. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Miriam Rubio --- 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 ec4996282e..c452d3f6b7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -716,7 +716,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) res = bisect_start(&terms, no_checkout, argv, argc); break; default: - return error("BUG: unknown subcommand '%d'", cmdmode); + BUG("unknown subcommand %d", (int)cmdmode); } free_terms(&terms); From patchwork Wed Jul 1 13:34:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636409 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD82D913 for ; Wed, 1 Jul 2020 13:35:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5C06207D0 for ; Wed, 1 Jul 2020 13:35:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="esKeZhb7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731150AbgGANff (ORCPT ); Wed, 1 Jul 2020 09:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730569AbgGANfe (ORCPT ); Wed, 1 Jul 2020 09:35:34 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7AAAC08C5C1 for ; Wed, 1 Jul 2020 06:35:33 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id s10so23820942wrw.12 for ; Wed, 01 Jul 2020 06:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2Y8RQWgTwF/RO1Uaus8CCVvUUfZv3gZ8SKcL2uuqtns=; b=esKeZhb7f+g7EHislyx8Bp4WAoCyU72uteB2IbeSuNHjz03ntyQylnKtBIKONOdM0i BVTz+AGDze8CrcxYuJ8bkLBncTm7V2qHFMnAvcOctPxRr+RfrIEl4BSc3IZHA8r6t2dr rrllwqYVTjxovOeeaHWgCeLf5Tj9MltBLoSm/aqkwU7agcQ41+WO/HBtgMcsd4bU5iaj DcR2h/yeQlHDY52S8H0oPnaOHtva/K2X4YV1CTXo3/Mf0ZeqlYTK7mXIb8DPx25P34M8 eWfCyNhGynDWfCqMRVLq2gDqniCZ/GlAV+hudq12a6TmdIlMBVDFBQjHXEDBKXzPDdaK UmzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2Y8RQWgTwF/RO1Uaus8CCVvUUfZv3gZ8SKcL2uuqtns=; b=CgmTtaBWI+RYDpkW/+ZTeKtVpia4VNHh9PUAUSl16CxqK/M0v1lnwv5VyJVE6JVkrM kUD4AfUMhG0am6k1AHJu80Edo+OGtLfbYk4ZEjMEu31pJ/ruOGxA26qgqqHTGYGANljp 2mhGKpg+IJprRG89s7gFWuKGdY+Z+YYOTlKip4FaqFdfIfW22u3xicW0CGjOhYLt3gfS 9CDWi0tZRNmHUeDjclNfhWIbl6bk7aZQH+i9No551Xh00a3pF+pim+RHi7AnXu3xKNyP bHypPVbD+fiCyoxeXzJCBOaO7f6Lyb5obRHrQ7CMcn3WJa/Gcq9esXUXQv3yOJnH5WC+ gz7g== X-Gm-Message-State: AOAM531apJvtbw48OztpgSAZGnEZGOLXYga4GgmH1PpKWBPtVpb7CBXJ fNho82FFSCGwzUbOv9MR04KUqdEOMqE= X-Google-Smtp-Source: ABdhPJwlDkkmzM3dO+cfJyHnqpRtF5GA4alN7k27dRJkQ12BW09Z9zStipfdLrbz9rxU2eHLxYFB+A== X-Received: by 2002:adf:f14e:: with SMTP id y14mr26920630wro.151.1593610532318; Wed, 01 Jul 2020 06:35:32 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:31 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Junio C Hamano Subject: [PATCH v4 02/13] bisect--helper: use '-res' in 'cmd_bisect__helper' return Date: Wed, 1 Jul 2020 15:34:53 +0200 Message-Id: <20200701133504.18360-3-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Following 'enum bisect_error' vocabulary, return variable 'res' is always non-positive. Let's use '-res' instead of 'abs(res)' to make the code clearer. Mentored-by: Christian Couder Signed-off-by: Miriam Rubio Helped-by: Junio C Hamano --- 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 c452d3f6b7..0466b07a43 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -727,5 +727,5 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) res = BISECT_OK; - return abs(res); + return -res; } From patchwork Wed Jul 1 13:34:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA2FB174A for ; Wed, 1 Jul 2020 13:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0FA6207D0 for ; Wed, 1 Jul 2020 13:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cHP8elnr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731152AbgGANfg (ORCPT ); Wed, 1 Jul 2020 09:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731148AbgGANff (ORCPT ); Wed, 1 Jul 2020 09:35:35 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA37FC08C5C1 for ; Wed, 1 Jul 2020 06:35:34 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id q5so23854581wru.6 for ; Wed, 01 Jul 2020 06:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2Iyoj9eRjykHyPqCeAP3BVjxxch5usuj5tsEK3bI5qg=; b=cHP8elnrl5zLSDMQSJQ1UY0Kzp7PJdMKbWBLrDj7IJoEEsLY1F7tZpY6t1Y2WFKIW+ yyORtk4iI0pFOw3WSvn35/u1sL1ejzHrRTGUIkTRVXw5rwaToMSYm4uvdzc1w4uvo+E4 LvWzhbpWnSeGzQfMHz2NAyzXwNyaRllgoPYDlcGkggYmczHr4/CW6AvAc+qoq5fhMXMk jLdiqBoNxSe68Gk5RffZ6OlsVw8HmkJHwgnIANNF+J/UWeJnJur3EGmS+UQh2Q8rUy2K 11aXCy+sIVAL7UAliBxEPZGOhbL9RFERhd88V+zbO1JM8JHaoe7Ny+0BF2lUgqKbSKeY MJ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2Iyoj9eRjykHyPqCeAP3BVjxxch5usuj5tsEK3bI5qg=; b=dWxZmWjJfx3mneQMagIu4bq5h/cNS5dgwYnC/KRkqJXepO1PwhUN2HfwKMpj+n1eeH jw6r/Hlp0E37wF2hsIqpT6zIUJ2MwMJ/IThHQl726P5GUSezr5qwz8dHanVep3zKk4S5 Hv+fqA2pgSs71qSi2hGKAeSQNnup7IqWsn+bF1NzEmlnHPkuy6tlWh/E+4E/QhcUO/Y/ OmXHx/honncRnb3Cil1lB26N5lN2U6D9Nz0ArBzfKw/wdXlFM0YBG9waVwutiiSei8an Ohq4MdRxHlQT1DQJdAnBCgS3UUbWENR1hboHZzE2gt5fh44ig8Ro9vdjo/NJi6bAIhJh 8Gkg== X-Gm-Message-State: AOAM5317c/iV+eS8HjhYv5PHUFCsqdHcsOBAsUArqAh0MzU/H4CGsrtA FnKIqssD38WedERklATGHq9mixCD6/g= X-Google-Smtp-Source: ABdhPJw8hJkmQ300epENYOrM7zLWyi0zJmleINgTF1fW8IZUJfeMFsidkJlVe9mt60JLCCHUEx3Vvw== X-Received: by 2002:a5d:4e87:: with SMTP id e7mr28401024wru.12.1593610533315; Wed, 01 Jul 2020 06:35:33 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:32 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH v4 03/13] bisect--helper: introduce new `write_in_file()` function Date: Wed, 1 Jul 2020 15:34:54 +0200 Message-Id: <20200701133504.18360-4-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Let's refactor code adding a new `write_in_file()` function that opens a file for writing a message and closes it and a wrapper for writting mode. This helper will be used in later steps and makes the code simpler and easier to understand. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 0466b07a43..b421056546 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -74,6 +74,38 @@ static int one_of(const char *term, ...) return res; } +static int write_in_file(const char *path, const char *mode, const char *format, va_list args) +{ + FILE *fp = NULL; + int res = 0; + + if (!strcmp(mode, "a") && !strcmp(mode, "w")) + return error(_("wrong writing mode '%s'"), mode); + fp = fopen(path, mode); + if (!fp) + return error_errno(_("cannot open file '%s' in mode '%s'"), path, mode); + res = vfprintf(fp, format, args); + + if (!res) { + fclose(fp); + return error_errno(_("could not write to file '%s'"), path); + } + + return fclose(fp); +} + +static int write_to_file(const char *path, const char *format, ...) +{ + int res; + va_list args; + + va_start(args, format); + res = write_in_file(path, "w", format, args); + va_end(args); + + return res; +} + static int check_term_format(const char *term, const char *orig_term) { int res; @@ -104,7 +136,6 @@ static int check_term_format(const char *term, const char *orig_term) static int write_terms(const char *bad, const char *good) { - FILE *fp = NULL; int res; if (!strcmp(bad, good)) @@ -113,12 +144,8 @@ static int write_terms(const char *bad, const char *good) if (check_term_format(bad, "bad") || check_term_format(good, "good")) return -1; - fp = fopen(git_path_bisect_terms(), "w"); - if (!fp) - return error_errno(_("could not open the file BISECT_TERMS")); + res = write_to_file(git_path_bisect_terms(), "%s\n%s\n", bad, good); - res = fprintf(fp, "%s\n%s\n", bad, good); - res |= fclose(fp); return (res < 0) ? -1 : 0; } From patchwork Wed Jul 1 13:34:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636413 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A858917C7 for ; Wed, 1 Jul 2020 13:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 908F3207D0 for ; Wed, 1 Jul 2020 13:35:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Um/9H+3I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731158AbgGANfj (ORCPT ); Wed, 1 Jul 2020 09:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730792AbgGANfg (ORCPT ); Wed, 1 Jul 2020 09:35:36 -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 0781CC08C5C1 for ; Wed, 1 Jul 2020 06:35:36 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id b6so23836055wrs.11 for ; Wed, 01 Jul 2020 06:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7nbieT4QtGXk0hmm0z7vqt2vlcmy3vOJN8DpcAIQOIw=; b=Um/9H+3IrlnjEt1zJ7uf5eb5kWaP7DZW2mNU174uLTCwSgTJPbacLlgSkJfj/AYuBg KDCiKZBS9ihdcGIMM+WmPfkAG9zkwPjydzcFcZ4oRMQfkwRqt+9PomsagDo02ewoKmrH HNehpHER/85bAREERynGjgKUlvzrkvhyNfnlPOPevKNlz5DnkwqlGVGUyHNhKT3kN83Y ImfAmlOEJwvijDJObAGcFvfmGu6OmeURWf5EJyNEWbPE3l8db3aARWeMW7rf1PO7UzNO WROoD2ax/hfvUiEj5vqdn1cbZ07ttgQhDmpdWSKTSC/enZpub3f64ajRbi4pJGghEsrh Ky6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7nbieT4QtGXk0hmm0z7vqt2vlcmy3vOJN8DpcAIQOIw=; b=kRE3tdGu1iVDrghm8fEQRKzCAA3otLEXOKyAlsvs5qG758iWRfiLeKAd7m1sbnwfga LKMjTJPjOvwQFPgYFNE4CS4eRAU9+RLK7Hc7CdadOeLK1AgqrX+I7spoog1+/VSsMdU3 mk2bhLZEJKJbIDGAsSrJ/0vtHimRqVQZdxBigowCNJswGe+OKiDsK8hl7FJuHS/I0vk4 ja7+YbOHsbaPXmKe33GswP/fffTWtWlFEr1fPv5NCkMt81Br/+gbZJ1sU3KvduG3FUTK at2BHOHf3Mva9eAlPEO+T5Jn7CjBwrGSDVomNRhYWI0nnXlxr1nUMJD7BUwqDscgJDiM DuwA== X-Gm-Message-State: AOAM530+qFFPzWpsC9TYsfkKCWnVL98/y48LJ0sWoR7CjzYlgdSbiOIP eYPURH4i+3X80etK1pFN2ijLpq+Bzr2MFw== X-Google-Smtp-Source: ABdhPJy2bUfXYSLlwebeKd+6ZSWgaezjPzPS1+of5lpZcWIANSZJX5Sl/TDHcRMZhvaJM1IkTZkUhQ== X-Received: by 2002:adf:f04c:: with SMTP id t12mr24948449wro.382.1593610534430; Wed, 01 Jul 2020 06:35:34 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:33 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 04/13] bisect--helper: reimplement `bisect_autostart` shell function in C Date: Wed, 1 Jul 2020 15:34:55 +0200 Message-Id: <20200701133504.18360-5-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_autostart()` shell function in C and add the C implementation from `bisect_next()` which was previously left uncovered. Add `--bisect-autostart` subcommand to be called from git-bisect.sh. Using `--bisect-autostart` subcommand is a temporary measure to port the shell function to C so as to use the existing test suite. As more functions are ported, this subcommand will be retired and bisect_autostart() will be called directly by `bisect_state()`. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 44 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 25 ++--------------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index b421056546..36166840d1 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -29,6 +29,7 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), N_("git bisect--helper --bisect-start [--term-{old,good}= --term-{new,bad}=]" "[--no-checkout] [ [...]] [--] [...]"), + N_("git bisect--helper --bisect-autostart"), NULL }; @@ -645,6 +646,38 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, return res; } +static inline int file_is_not_empty(const char *path) +{ + return !is_empty_or_missing_file(path); +} + +static int bisect_autostart(struct bisect_terms *terms) +{ + int res; + const char *yesno; + + if (file_is_not_empty(git_path_bisect_start())) + return 0; + + fprintf_ln(stderr, _("You need to start by \"git bisect " + "start\"\n")); + + if (!isatty(STDIN_FILENO)) + return 0; + + /* + * TRANSLATORS: Make sure to include [Y] and [n] in your + * translation. The program will only accept English input + * at this point. + */ + yesno = git_prompt(_("Do you want me to do it for you " + "[Y/n]? "), PROMPT_ECHO); + res = tolower(*yesno) == 'n' ? + -1 : bisect_start(terms, 0, NULL, 0); + + return res; +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -657,7 +690,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, BISECT_TERMS, - BISECT_START + BISECT_START, + BISECT_AUTOSTART, } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -681,6 +715,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) 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-autostart", &cmdmode, + N_("start the bisection if it has not yet been started"), BISECT_AUTOSTART), OPT_BOOL(0, "no-checkout", &no_checkout, N_("update BISECT_HEAD instead of checking out the current commit")), OPT_BOOL(0, "no-log", &nolog, @@ -742,6 +778,12 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_start(&terms, no_checkout, argv, argc); break; + case BISECT_AUTOSTART: + if (argc) + return error(_("--bisect-autostart does not accept arguments")); + set_terms(&terms, "bad", "good"); + res = bisect_autostart(&terms); + break; default: BUG("unknown subcommand %d", (int)cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 08a6ed57dd..d7a6990c29 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -49,27 +49,6 @@ bisect_head() fi } -bisect_autostart() { - test -s "$GIT_DIR/BISECT_START" || { - gettextln "You need to start by \"git bisect start\"" >&2 - if test -t 0 - then - # TRANSLATORS: Make sure to include [Y] and [n] in your - # translation. The program will only accept English input - # at this point. - gettext "Do you want me to do it for you [Y/n]? " >&2 - read yesno - case "$yesno" in - [Nn]*) - exit ;; - esac - bisect_start - else - exit 1 - fi - } -} - bisect_start() { git bisect--helper --bisect-start $@ || exit @@ -108,7 +87,7 @@ bisect_skip() { } bisect_state() { - bisect_autostart + git bisect--helper --bisect-autostart state=$1 git bisect--helper --check-and-set-terms $state $TERM_GOOD $TERM_BAD || exit get_terms @@ -149,7 +128,7 @@ bisect_auto_next() { bisect_next() { case "$#" in 0) ;; *) usage ;; esac - bisect_autostart + git bisect--helper --bisect-autostart git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit # Perform all bisection computation, display and checkout From patchwork Wed Jul 1 13:34:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2957F912 for ; Wed, 1 Jul 2020 13:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1050E20760 for ; Wed, 1 Jul 2020 13:35:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bRD+/q03" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731157AbgGANfj (ORCPT ); Wed, 1 Jul 2020 09:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731148AbgGANfh (ORCPT ); Wed, 1 Jul 2020 09:35:37 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6A1C08C5C1 for ; Wed, 1 Jul 2020 06:35:36 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id b6so23836113wrs.11 for ; Wed, 01 Jul 2020 06:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yJBqQyCyaifjDmIyIOSXfw9cRsG6/XuqaQklreu6lS0=; b=bRD+/q03oH9xvfGf3DO48XogT2ln8rV16swLRCXc12C45x3brFsbwmMMkvToKDAaOq tDjt4YA7rllNeqgCXxO7/1aAHyzoXxodBaDgpjIMuRPw8KWfvCDLUlr6WZY7nV4+ypDd cj2g0rxyPhYStYevBSWiiSn71R7TWlH2/J6yec/oTcyGpQKMFvKkeQjPgw9Au2TjAavE IJDWTcPBjsfB34D+y9Oc4dsjWLVBDObKT+Dzot2u45P1Y8/pn3t/XfGv7qVsdNXodRB6 b6SLg/0kfb1YCR0KmeWbd7hkiQ04H/cJPPMWCH7SrWmmgHxfkFCvYnu5SDqCIbv93GDL Gj1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yJBqQyCyaifjDmIyIOSXfw9cRsG6/XuqaQklreu6lS0=; b=ZfGOFATKQj3+IS5icAwIywoGTncRW4F3y9EMUK+7igYnVBENt1a7e4VylAexWF9CR9 WjmNOD0/Y3vxfGrpL/c3TTib8+NtLKs4ZVDeWwyQJm04DMI+cuXfhd9CNl2p4U54LbQP KOY2TjCc3enzNUbnjpCoOxCV2JShrbmXYO34J4KmKUQs6zo1y9O5fYBOHhfo7B4BPTIM Id7QSbK3oEpucDnmWpIbId3oJ0fajxIM32Cds2D8uvvBtfX8Q52zw7+Z74kCPyl3RwH6 yznUIWaMXv/IGpB9Zm8xGK1swiTJnsQDGw1v3iwvhKhH8leC8X4z8OxD6z/cSEsOT904 pZkg== X-Gm-Message-State: AOAM532vvvDet9Xrh6VGliUYr0s65eiBNMLzYBBX/ucccWqfF5igplhL HBT1HYr0QqTgx+3T/NvNeh6RukRuxIg= X-Google-Smtp-Source: ABdhPJw4+N798pepeOsOhMPNByb2X2fC0f3+f8jMObGC3O1j3n3qTssFFMBVSW084ToIQL1c3WgzEA== X-Received: by 2002:a05:6000:1182:: with SMTP id g2mr25064356wrx.44.1593610535464; Wed, 01 Jul 2020 06:35:35 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:34 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder Subject: [PATCH v4 05/13] bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()' Date: Wed, 1 Jul 2020 15:34:56 +0200 Message-Id: <20200701133504.18360-6-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As there can be other revision walks after bisect_next_all(), let's add a call to a function to clear all the marks at the end of bisect_next_all(). Mentored-by: Christian Couder Signed-off-by: Miriam Rubio --- bisect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bisect.c b/bisect.c index d5e830410f..db00850065 100644 --- a/bisect.c +++ b/bisect.c @@ -1064,6 +1064,8 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix, int "Bisecting: %d revisions left to test after this %s\n", nr), nr, steps_msg); free(steps_msg); + /* Clean up objects used, as they will be reused. */ + clear_commit_marks_all(ALL_REV_FLAGS); return bisect_checkout(bisect_rev, no_checkout); } From patchwork Wed Jul 1 13:34:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49978913 for ; Wed, 1 Jul 2020 13:35:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25442207D0 for ; Wed, 1 Jul 2020 13:35:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IKtjC/KK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731062AbgGANfl (ORCPT ); Wed, 1 Jul 2020 09:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731155AbgGANfi (ORCPT ); Wed, 1 Jul 2020 09:35:38 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B281C08C5C1 for ; Wed, 1 Jul 2020 06:35:38 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id a6so23869236wrm.4 for ; Wed, 01 Jul 2020 06:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0+TBjK09n0JdK3COj+yxvL9U2kCGDaC7n99KaRZYjgE=; b=IKtjC/KKCLM9OSs3CQWtzcpQJWSz8yN5KcQuFzvxN+ggVb3nsOhKDE0IGl3c1PsEsp C88ktnUE9FXzYtWY1Fbz3TpwSmB8eIGjRL7t/roGWvhGzTbFywUnTRexYoEQ8CXcbEKZ +/7VQLbu+K7DZL0igS6Yw4QHbfKfi9be5uTVkJHeY1Jg0WU63BCEvg/QMDSyXMrUTRcS D24gwCn5j6vvpbeTzgSxUXTej1mKlNtsBOVc6iNjhxDIdz9ySzyjcjsRbRflnIxCHjFf lct9xg60Rz+288i1dDNWH90SaTiCXD5/dswnPKRx3Sn8R9PUfXFuWfa10T1g9awh71vg GTtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0+TBjK09n0JdK3COj+yxvL9U2kCGDaC7n99KaRZYjgE=; b=YnPlXT0nV4P39L3FmiO1mqH+6l+miP483UuU1PICZ+3de5KheBwEkoPLkDmUR+hqf5 2h5DRzVW2hLu1bUMlCfZW8YS15PApD/53OCTacRMcMEzrBlupYX8ykawFIP1QzCBnU5x gBTbj4p6iG3YRaaHjS9PwlCOxmOdPegBxC5gfPTHa16fLQrNvEIneW0FwaHF5ZR/ax9O kDrSOkVMaQQ4i33HYhjm2zTDjuelKIw/JOzt35+qgnib4TZ03G6hTkhfYrb3Dhkc4Sps vpgO8J/QzGBD4sqOFTMZlEZWt29U0xiXXGqygrGvTvmnLd3oXDc7dmtwoicYHWWuB1Hr THDQ== X-Gm-Message-State: AOAM530P2mf+T4hn+5devTDwMzIpY4UqHwoIT3brg+k1DwJbr7XZxVDQ dbz4VVBuHzXoSG0LBEBNBzb6eDw/+Kf0dg== X-Google-Smtp-Source: ABdhPJzqVuFyGhKKQoDmuCFITCS95bfSygFZvh/tQygI4oxsR2rNBU0Rnwn1wz80+B5XJtlplhItrw== X-Received: by 2002:adf:a34a:: with SMTP id d10mr2700767wrb.59.1593610536614; Wed, 01 Jul 2020 06:35:36 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:36 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 06/13] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C Date: Wed, 1 Jul 2020 15:34:57 +0200 Message-Id: <20200701133504.18360-7-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_next()` and the `bisect_auto_next()` shell functions in C and add the subcommands to `git bisect--helper` to call them from git-bisect.sh . bisect_auto_next() function returns an enum bisect_error type as whole `git bisect` can exit with an error code when bisect_next() does. Using `--bisect-next` and `--bisect-auto-next` subcommands is a temporary measure to port shell function to C so as to use the existing test suite. As more functions are ported, `--bisect-auto-next` subcommand will be retired and will be called by some other methods. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- bisect.c | 6 ++ builtin/bisect--helper.c | 181 ++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 47 +--------- 3 files changed, 189 insertions(+), 45 deletions(-) diff --git a/bisect.c b/bisect.c index db00850065..0864e2a21b 100644 --- a/bisect.c +++ b/bisect.c @@ -980,6 +980,12 @@ void read_bisect_terms(const char **read_bad, const char **read_good) * the bisection process finished successfully. * In this case the calling function or command should not turn a * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND return code into an error or a non zero exit code. + * + * Checking BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND + * in bisect_helper::bisect_next() and only transforming it to 0 at + * the end of bisect_helper::cmd_bisect__helper() helps bypassing + * all the code related to finding a commit to test. + * * If no_checkout is non-zero, the bisection process does not * checkout the trial commit but instead simply updates BISECT_HEAD. */ diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 36166840d1..9a9705c9e3 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -8,6 +8,7 @@ #include "run-command.h" #include "prompt.h" #include "quote.h" +#include "revision.h" static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") @@ -29,10 +30,17 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), N_("git bisect--helper --bisect-start [--term-{old,good}= --term-{new,bad}=]" "[--no-checkout] [ [...]] [--] [...]"), + N_("git bisect--helper --bisect-next"), + N_("git bisect--helper --bisect-auto-next"), N_("git bisect--helper --bisect-autostart"), NULL }; +struct add_bisect_ref_data { + struct rev_info *revs; + unsigned int object_flags; +}; + struct bisect_terms { char *term_good; char *term_bad; @@ -56,6 +64,8 @@ static void set_terms(struct bisect_terms *terms, const char *bad, static const char vocab_bad[] = "bad|new"; static const char vocab_good[] = "good|old"; +static int bisect_autostart(struct bisect_terms *terms); + /* * Check whether the string `term` belongs to the set of strings * included in the variable arguments. @@ -107,6 +117,18 @@ static int write_to_file(const char *path, const char *format, ...) return res; } +static int append_to_file(const char *path, const char *format, ...) +{ + int res; + va_list args; + + va_start(args, format); + res = write_in_file(path, "a", format, args); + va_end(args); + + return res; +} + static int check_term_format(const char *term, const char *orig_term) { int res; @@ -449,6 +471,143 @@ static int bisect_append_log_quoted(const char **argv) return res; } +static int add_bisect_ref(const char *refname, const struct object_id *oid, + int flags, void *cb) +{ + struct add_bisect_ref_data *data = cb; + + add_pending_oid(data->revs, refname, oid, data->object_flags); + + return 0; +} + +static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs) +{ + int res = 0; + struct add_bisect_ref_data cb = { revs }; + char *good = xstrfmt("%s-*", terms->term_good); + + /* + * We cannot use terms->term_bad directly in + * for_each_glob_ref_in() and we have to append a '*' to it, + * otherwise for_each_glob_ref_in() will append '/' and '*'. + */ + char *bad = xstrfmt("%s*", terms->term_bad); + + /* + * It is important to reset the flags used by revision walks + * as the previous call to bisect_next_all() in turn + * sets up a revision walk. + */ + reset_revision_walk(); + init_revisions(revs, NULL); + setup_revisions(0, NULL, revs, NULL); + for_each_glob_ref_in(add_bisect_ref, bad, "refs/bisect/", &cb); + cb.object_flags = UNINTERESTING; + for_each_glob_ref_in(add_bisect_ref, good, "refs/bisect/", &cb); + if (prepare_revision_walk(revs)) + res = error(_("revision walk setup failed\n")); + + free(good); + free(bad); + return res; +} + +static int bisect_skipped_commits(struct bisect_terms *terms) +{ + int res; + FILE *fp = NULL; + struct rev_info revs; + struct commit *commit; + struct pretty_print_context pp = {0}; + struct strbuf commit_name = STRBUF_INIT; + + res = prepare_revs(terms, &revs); + if (res) + return res; + + fp = fopen(git_path_bisect_log(), "a"); + if (!fp) + return error_errno(_("could not open '%s' for appending"), + git_path_bisect_log()); + + if (fprintf(fp, "# only skipped commits left to test\n") < 0) + return error_errno(_("failed to write to '%s'"), git_path_bisect_log()); + + while ((commit = get_revision(&revs)) != NULL) { + strbuf_reset(&commit_name); + format_commit_message(commit, "%s", + &commit_name, &pp); + fprintf(fp, "# possible first %s commit: [%s] %s\n", + terms->term_bad, oid_to_hex(&commit->object.oid), + commit_name.buf); + } + + /* + * Reset the flags used by revision walks in case + * there is another revision walk after this one. + */ + reset_revision_walk(); + + strbuf_release(&commit_name); + fclose(fp); + return 0; +} + +static int bisect_successful(struct bisect_terms *terms) +{ + struct object_id oid; + struct commit *commit; + struct pretty_print_context pp = {0}; + struct strbuf commit_name = STRBUF_INIT; + char *bad_ref = xstrfmt("refs/bisect/%s",terms->term_bad); + int res; + + read_ref(bad_ref, &oid); + commit = lookup_commit_reference_by_name(bad_ref); + format_commit_message(commit, "%s", &commit_name, &pp); + + res = append_to_file(git_path_bisect_log(), "# first %s commit: [%s] %s\n", + terms->term_bad, oid_to_hex(&commit->object.oid), + commit_name.buf); + + strbuf_release(&commit_name); + free(bad_ref); + return res; +} + +static enum bisect_error bisect_next(struct bisect_terms *terms, const char *prefix) +{ + int no_checkout; + enum bisect_error res; + + bisect_autostart(terms); + if (bisect_next_check(terms, terms->term_good)) + return BISECT_FAILED; + + no_checkout = file_exists(git_path_bisect_head()); + + /* Perform all bisection computation, display and checkout */ + res = bisect_next_all(the_repository, prefix, no_checkout); + + if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) { + res = bisect_successful(terms); + return res ? res : BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND; + } else if (res == BISECT_ONLY_SKIPPED_LEFT) { + res = bisect_skipped_commits(terms); + return res ? res : BISECT_ONLY_SKIPPED_LEFT; + } + return res; +} + +static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char *prefix) +{ + if (bisect_next_check(terms, NULL)) + return BISECT_OK; + + return bisect_next(terms, prefix); +} + static int bisect_start(struct bisect_terms *terms, int no_checkout, const char **argv, int argc) { @@ -691,7 +850,9 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_NEXT_CHECK, BISECT_TERMS, BISECT_START, - BISECT_AUTOSTART, + BISECT_NEXT, + BISECT_AUTO_NEXT, + BISECT_AUTOSTART } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -715,6 +876,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) 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-auto-next", &cmdmode, + N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), OPT_CMDMODE(0, "bisect-autostart", &cmdmode, N_("start the bisection if it has not yet been started"), BISECT_AUTOSTART), OPT_BOOL(0, "no-checkout", &no_checkout, @@ -778,6 +943,18 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_start(&terms, no_checkout, argv, argc); break; + case BISECT_NEXT: + if (argc) + return error(_("--bisect-next requires 0 arguments")); + get_terms(&terms); + res = bisect_next(&terms, prefix); + break; + case BISECT_AUTO_NEXT: + if (argc) + return error(_("--bisect-auto-next requires 0 arguments")); + get_terms(&terms); + res = bisect_auto_next(&terms, prefix); + break; case BISECT_AUTOSTART: if (argc) return error(_("--bisect-autostart does not accept arguments")); @@ -793,7 +970,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) * Handle early success * From check_merge_bases > check_good_are_ancestors_of_bad > bisect_next_all */ - if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) + if ((res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) || (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND)) res = BISECT_OK; return -res; diff --git a/git-bisect.sh b/git-bisect.sh index d7a6990c29..809be25424 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -65,8 +65,7 @@ bisect_start() { # # Check if we can proceed to the next bisect state. # - get_terms - bisect_auto_next + git bisect--helper --bisect-auto-next || exit trap '-' 0 } @@ -119,45 +118,7 @@ bisect_state() { *) usage ;; esac - bisect_auto_next -} - -bisect_auto_next() { - git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD && bisect_next || : -} - -bisect_next() { - case "$#" in 0) ;; *) usage ;; esac - git bisect--helper --bisect-autostart - git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit - - # Perform all bisection computation, display and checkout - git bisect--helper --next-all $(test -f "$GIT_DIR/BISECT_HEAD" && echo --no-checkout) - res=$? - - # Check if we should exit because bisection is finished - if test $res -eq 10 - then - bad_rev=$(git show-ref --hash --verify refs/bisect/$TERM_BAD) - bad_commit=$(git show-branch $bad_rev) - echo "# first $TERM_BAD commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG" - exit 0 - elif test $res -eq 2 - then - echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG" - good_revs=$(git for-each-ref --format="%(objectname)" "refs/bisect/$TERM_GOOD-*") - for skipped in $(git rev-list refs/bisect/$TERM_BAD --not $good_revs) - do - skipped_commit=$(git show-branch $skipped) - echo "# possible first $TERM_BAD commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG" - done - exit $res - fi - - # Check for an error in the bisection process - test $res -ne 0 && exit $res - - return 0 + git bisect--helper --bisect-auto-next } bisect_visualize() { @@ -213,7 +174,7 @@ bisect_replay () { esac done <"$file" IFS="$oIFS" - bisect_auto_next + git bisect--helper --bisect-auto-next } bisect_run () { @@ -310,7 +271,7 @@ case "$#" in bisect_skip "$@" ;; next) # Not sure we want "next" at the UI level anymore. - bisect_next "$@" ;; + git bisect--helper --bisect-next "$@" || exit ;; visualize|view) bisect_visualize "$@" ;; reset) From patchwork Wed Jul 1 13:34:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636423 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F0A117C7 for ; Wed, 1 Jul 2020 13:35:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84A71207F9 for ; Wed, 1 Jul 2020 13:35:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aZ6BmbYP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731166AbgGANfo (ORCPT ); Wed, 1 Jul 2020 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730792AbgGANfk (ORCPT ); Wed, 1 Jul 2020 09:35:40 -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 88DC5C08C5DB for ; Wed, 1 Jul 2020 06:35:39 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id z13so23868833wrw.5 for ; Wed, 01 Jul 2020 06:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H6B82yBHN3PPRK+wuQVBl1RqNKJtxlXluuF0TDsVsNg=; b=aZ6BmbYP44kcjLg4u1cQyH6CGl3pLA/sgRxJXU6w3XTGiugckV+24jcVc0ahvuNSlI iZqSnWpeU1D+g6PV8t//u/KbSV1RKJMnDrs8dmEnbx1O40D/RO8DJLB7B5Wr4qlyimhP Q+J3sVjO5fGbzUe2aKutErwDDDkv6urd0ywsmfbaeLXRmz5UNZDPwKL3HaaZ4mu4jHMk lgDc54+EVihGSLb6ArtYY6lwJk63fwHXE+darA3GTzw45khKoB4I58807enNVKtWjLbZ j7wcfzvs4K2aM0P6Zh70Ru6RD8qBX8qC6qI/jJS0XoBgBCF/7Hr5NDiVjrRmt9x3jzHk dHCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H6B82yBHN3PPRK+wuQVBl1RqNKJtxlXluuF0TDsVsNg=; b=C1v4DdKQ/uz7MMAlyaOIS+NOv2gSnjka+EZtPRKP3rbsdo1srbCQQTKO0ZJAHWhvJX 0fczEHkfMVieFHqAIdPBi/yOIiAypAHfc3cES4kgQNpPuRuTuMGNcWa2zbyXUC3kr3Vf UPXEftyObWQ3rByltHfbEUEDFWis7IFPYSKyf4y8VpLJcMakiihlj832VkhEoY7N+N48 eGYZh6AxWf/fleAhWuwecH9j1oeJVJ+DaTPZ9Ylb7c6tZl82qH16Tylv3vtRaLxsjAwg IIvqLpi32H/fAMblxdsNX4qquKrEzyv5rvrfLCmWZparY9MyEHiyhEXrZYeZ6KTIGLTw P/mA== X-Gm-Message-State: AOAM533b6m7Insz0eVkHb3qeV+Gnst9a4lE1AVYWheX8WL78ZvdWU4U0 7or8+kPcXAsnNd+3cYEhw6iKDhBDBhk= X-Google-Smtp-Source: ABdhPJxi9JDODQtmvrUeyqs1x5utIToRQsXkXlehcKLkN12AXNCqXyPTA9y0DI1J5G/8vryXE8lvEw== X-Received: by 2002:adf:ef01:: with SMTP id e1mr28597453wro.116.1593610537836; Wed, 01 Jul 2020 06:35:37 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:37 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 07/13] bisect--helper: finish porting `bisect_start()` to C Date: Wed, 1 Jul 2020 15:34:58 +0200 Message-Id: <20200701133504.18360-8-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Add the subcommand to `git bisect--helper` and call it from git-bisect.sh. With the conversion of `bisect_auto_next()` from shell to C in a previous commit, `bisect_start()` can now be fully ported to C. So let's complete the `--bisect-start` subcommand of `git bisect--helper` so that it fully implements `bisect_start()`, and let's use this subcommand in `git-bisect.sh` instead of `bisect_start()`. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 56 ++++++++++++++++++++++++++++------------ git-bisect.sh | 26 ++----------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 9a9705c9e3..b52a925dc6 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -85,6 +85,19 @@ static int one_of(const char *term, ...) return res; } +/* + * return code BISECT_INTERNAL_SUCCESS_MERGE_BASE + * and BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND are codes + * that indicate special success. + */ + +static int is_bisect_success(enum bisect_error res) +{ + return !res || + res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND || + res == BISECT_INTERNAL_SUCCESS_MERGE_BASE; +} + static int write_in_file(const char *path, const char *mode, const char *format, va_list args) { FILE *fp = NULL; @@ -608,11 +621,12 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char return bisect_next(terms, prefix); } -static int bisect_start(struct bisect_terms *terms, int no_checkout, +static enum bisect_error bisect_start(struct bisect_terms *terms, int no_checkout, const char **argv, int argc) { int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0; - int flags, pathspec_pos, res = 0; + int flags, pathspec_pos; + enum bisect_error res = BISECT_OK; struct string_list revs = STRING_LIST_INIT_DUP; struct string_list states = STRING_LIST_INIT_DUP; struct strbuf start_head = STRBUF_INIT; @@ -670,9 +684,12 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, return error(_("unrecognized option: '%s'"), arg); } else { char *commit_id = xstrfmt("%s^{commit}", arg); - if (get_oid(commit_id, &oid) && has_double_dash) - die(_("'%s' does not appear to be a valid " - "revision"), arg); + if (get_oid(commit_id, &oid) && has_double_dash) { + error(_("'%s' does not appear to be a valid " + "revision"), arg); + free(commit_id); + return BISECT_FAILED; + } string_list_append(&revs, oid_to_hex(&oid)); free(commit_id); @@ -750,14 +767,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, * Get rid of any old bisect state. */ if (bisect_clean_state()) - return -1; - - /* - * In case of mistaken revs or checkout error, or signals received, - * "bisect_auto_next" below may exit or misbehave. - * We have to trap this to be able to clean up using - * "bisect_clean_state". - */ + return BISECT_FAILED; /* * Write new start state @@ -771,7 +781,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, } if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0, UPDATE_REFS_MSG_ON_ERR)) { - res = -1; + res = BISECT_FAILED; goto finish; } } @@ -783,25 +793,37 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, for (i = 0; i < states.nr; i++) if (bisect_write(states.items[i].string, revs.items[i].string, terms, 1)) { - res = -1; + res = BISECT_FAILED; goto finish; } if (must_write_terms && write_terms(terms->term_bad, terms->term_good)) { - res = -1; + res = BISECT_FAILED; goto finish; } res = bisect_append_log_quoted(argv); if (res) - res = -1; + res = BISECT_FAILED; finish: string_list_clear(&revs, 0); string_list_clear(&states, 0); strbuf_release(&start_head); strbuf_release(&bisect_names); + if (res) + return res; + + res = bisect_auto_next(terms, NULL); + /* + * In case of mistaken revs or checkout error, + * "bisect_auto_next" above may exit or misbehave. + * We have to handle this to be able to clean up using + * "bisect_clean_state". + */ + if (!is_bisect_success(res)) + bisect_clean_state(); return res; } diff --git a/git-bisect.sh b/git-bisect.sh index 809be25424..cfb05c0511 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -49,27 +49,6 @@ bisect_head() fi } -bisect_start() { - git bisect--helper --bisect-start $@ || exit - - # - # Change state. - # In case of mistaken revs or checkout error, or signals received, - # "bisect_auto_next" below may exit or misbehave. - # We have to trap this to be able to clean up using - # "bisect_clean_state". - # - trap 'git bisect--helper --bisect-clean-state' 0 - trap 'exit 255' 1 2 3 15 - - # - # Check if we can proceed to the next bisect state. - # - git bisect--helper --bisect-auto-next || exit - - trap '-' 0 -} - bisect_skip() { all='' for arg in "$@" @@ -163,8 +142,7 @@ bisect_replay () { get_terms case "$command" in start) - cmd="bisect_start $rev $tail" - eval "$cmd" ;; + eval "git bisect--helper --bisect-start $rev $tail" ;; "$TERM_GOOD"|"$TERM_BAD"|skip) git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;; terms) @@ -264,7 +242,7 @@ case "$#" in help) git bisect -h ;; start) - bisect_start "$@" ;; + git bisect--helper --bisect-start "$@" ;; bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") bisect_state "$cmd" "$@" ;; skip) From patchwork Wed Jul 1 13:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4899E912 for ; Wed, 1 Jul 2020 13:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DCE5207F5 for ; Wed, 1 Jul 2020 13:35:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QJMPiUjZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731172AbgGANfo (ORCPT ); Wed, 1 Jul 2020 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731155AbgGANfm (ORCPT ); Wed, 1 Jul 2020 09:35:42 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EBB9C08C5C1 for ; Wed, 1 Jul 2020 06:35:41 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id 17so23261921wmo.1 for ; Wed, 01 Jul 2020 06:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jRhE3tApwzz9qQbAyQgGqr8p2BgzyfGu4ALV1eTUN+A=; b=QJMPiUjZ7xAxlLG41FIPbUQF6ldZIT5HtJM+CwKXzbDMr4O0QAOrfhB+qjj7o5MTVv GlKri9RLrmkD5DvD8gE/jvNwl5WWI2HMwopYysPEbO6OX0VOGYqLkACMNf3v9oZaDvLP usK6J1kD0SnmYdGt+xVGFfuoYRjrQ3ioID3E3raYvC4ZeLh1f6JWLW053QLImpiJbYNP kY+zkWfyNIUDmwRrfTrnJlfqJXhLhZ+tSwqZMKqmGLIPd3WCiPEDKKBlSYrG+mjxd5ag lbUfI7Gof4jpYF0UfFD9AXnNMd0FkFjbkbGDiLqP0mSHDy/zHki3r18sE2dTz76ub6nz pESg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jRhE3tApwzz9qQbAyQgGqr8p2BgzyfGu4ALV1eTUN+A=; b=R58p0ONWkiYNHN2sUizzSpLHcNyA9vUQMKcSx5pXSwq5V4IqsdZFvX6W5dS2XKgTwP uV1shdm+nU2Vq9ZOU9gnE1lQeEWytaF4U/g7Tr7bPzVI71mjISkDdXzWvvAgnXMxG2iC 4HG6RtuvWpMh3Mt3zMpDZJ36P9MYrN9dsMIv059YiIMBMwyCEJydCtAicFz8/fXKFCpg PGCzKCyAwybuShc5juBsBYUXQ21822DBTCPl+1eBpHZmug/QIDUCXECctbG997QsxTfC ZEvEu7HeVUtN2IJ3UWEnbh+suIkKLPagYY+gZRSqdocl5zobDAOyvmiiI666SUWhA5p4 QrpQ== X-Gm-Message-State: AOAM532eVWksusV25UXw477GWS6aqnZJXcaKPWvCdVMiPZvFYFvyKqk+ +lLKNv8MfYQPACalRHSFUBQvcLlU2yk= X-Google-Smtp-Source: ABdhPJybjGxMrD+H5mhmzcjhHfwoQY3p/gSKc9aKoHqTBaowG3lDebjHPaJCQmgsKn56boyvnNnkMA== X-Received: by 2002:a1c:3c83:: with SMTP id j125mr26467975wma.65.1593610539906; Wed, 01 Jul 2020 06:35:39 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:38 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 08/13] bisect--helper: retire `--bisect-clean-state` subcommand Date: Wed, 1 Jul 2020 15:34:59 +0200 Message-Id: <20200701133504.18360-9-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--bisect-clean-state` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_clean_state()` is directly called from the C implementation. Mentored-by: Lars Schneider Mentored-by: Christian Couder Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index b52a925dc6..59385e2b9d 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -22,7 +22,6 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --next-all [--no-checkout]"), N_("git bisect--helper --write-terms "), - N_("git bisect--helper --bisect-clean-state"), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), N_("git bisect--helper --bisect-check-and-set-terms "), @@ -864,7 +863,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) enum { NEXT_ALL = 1, WRITE_TERMS, - BISECT_CLEAN_STATE, CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, @@ -882,8 +880,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("perform 'git bisect next'"), NEXT_ALL), OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), - OPT_CMDMODE(0, "bisect-clean-state", &cmdmode, - N_("cleanup the bisection state"), BISECT_CLEAN_STATE), OPT_CMDMODE(0, "check-expected-revs", &cmdmode, N_("check for expected revs"), CHECK_EXPECTED_REVS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, @@ -927,10 +923,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (argc != 2) return error(_("--write-terms requires two arguments")); return write_terms(argv[0], argv[1]); - case BISECT_CLEAN_STATE: - if (argc != 0) - return error(_("--bisect-clean-state requires no arguments")); - return bisect_clean_state(); case CHECK_EXPECTED_REVS: check_expected_revs(argv, argc); return 0; From patchwork Wed Jul 1 13:35:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67F6B912 for ; Wed, 1 Jul 2020 13:35:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4AD5E207F5 for ; Wed, 1 Jul 2020 13:35:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R9/4h/Es" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731134AbgGANfp (ORCPT ); Wed, 1 Jul 2020 09:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731161AbgGANfn (ORCPT ); Wed, 1 Jul 2020 09:35:43 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0294CC08C5DC for ; Wed, 1 Jul 2020 06:35:43 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id l17so22462392wmj.0 for ; Wed, 01 Jul 2020 06:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vbdsvKjzU0UnoYa8KZsCBXF+EruRq+Y58XPmYZGj/os=; b=R9/4h/Ess1fhF9JQ/ss+DVVNzdulSiiDbOgY2DF1O/JuKFxTH9PuSnQ5unSLXmnm6J Ebjt5acKX0O5c4MFtb6A4jE6GWXkQCBsI9B4X80ZXcYpMORF1eiyXEKlvAY+MZWDIsg/ xpkh8zBPiJ4N61Q0qKdSrQI5js/DVUbcvZ0qi5Pm7EKQQktV4pbq7MMs7DkIbrZSi4QD Tn7N7wKuxoN/JPPeclUELGiLy2x/DE0+K/x8UyX9SgTyEXXOBv+WXGFloC/nj1ruNO6u JVMIIEPlnSGj/eQ9T2oDRqVzbU7SEU3eomNEZNqG1jS2fr/hJU6jff5PN+gj0ILE1zRF NwcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vbdsvKjzU0UnoYa8KZsCBXF+EruRq+Y58XPmYZGj/os=; b=Sd1XHKyFFfemab0JbvUJ13Lu24n6RzXqEh+dk0qigDN+47Plak9aei8lcwlfF0Vr8Q CSR8FCkgFfytGveR+ilcqWZLza358i9+ctrFXlkpBk334rfvrb7vJ6ZhAeOWMvsrYdSu TS7wlrtwek552y/lmXoJiXNY7yu5idrlu7mgDyBVTaVNvXU1diiIeiTpf/GkfgNwtj/+ rDNIyBroRAlDlCXCGRyEuZp+XF6IVf5GJcU/PS3i5ZXAG+hxAgp5kM9Qo5UA3t63QcYY sU3lO/f01FrHGK1WdXNVPefp7rqLvcUhKaG+GALPKl4Tz4Vq447sOsQz3Lf5XQEUxbNB nnUg== X-Gm-Message-State: AOAM532Cbou4cVobQIc0YvbEe8BC2XiAnUEST+62qeDntRAitYMvCyZh vwp5W0gTnnSg19pNY9GXZgrx796LlsY= X-Google-Smtp-Source: ABdhPJz9/GxxSbz/MDJk6evEeOhSfiPXJ99vchnTzGTZOyGoA2tiJrxLTyM25fb7MmidiRALIq4Zhw== X-Received: by 2002:a05:600c:c1:: with SMTP id u1mr27340080wmm.48.1593610541384; Wed, 01 Jul 2020 06:35:41 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:40 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 09/13] bisect--helper: retire `--next-all` subcommand Date: Wed, 1 Jul 2020 15:35:00 +0200 Message-Id: <20200701133504.18360-10-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--next-all` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_next_all()` is called from the C implementation of `bisect_next()`. Mentored-by: Lars Schneider Mentored-by: Christian Couder Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 59385e2b9d..3ded6a0ea2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_head_name, "head-name") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --next-all [--no-checkout]"), N_("git bisect--helper --write-terms "), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), @@ -861,8 +860,7 @@ static int bisect_autostart(struct bisect_terms *terms) int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - NEXT_ALL = 1, - WRITE_TERMS, + WRITE_TERMS = 1, CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, @@ -876,8 +874,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { - OPT_CMDMODE(0, "next-all", &cmdmode, - N_("perform 'git bisect next'"), NEXT_ALL), OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), OPT_CMDMODE(0, "check-expected-revs", &cmdmode, @@ -916,9 +912,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case NEXT_ALL: - res = bisect_next_all(the_repository, prefix, no_checkout); - break; case WRITE_TERMS: if (argc != 2) return error(_("--write-terms requires two arguments")); From patchwork Wed Jul 1 13:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636421 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78AA5913 for ; Wed, 1 Jul 2020 13:35:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5ACC6206BE for ; Wed, 1 Jul 2020 13:35:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oIktA5l/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731173AbgGANfr (ORCPT ); Wed, 1 Jul 2020 09:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729332AbgGANfp (ORCPT ); Wed, 1 Jul 2020 09:35:45 -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 80E0FC08C5DC for ; Wed, 1 Jul 2020 06:35:44 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 17so23262116wmo.1 for ; Wed, 01 Jul 2020 06:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P6HSTBj8mmPeZRpWo8jeAdM3JIm4llQZnyUKHBtFk6s=; b=oIktA5l/2TKXLhXw3/7Nu2xPXHaa51uhGqq9CFVlI7Bi5VUh16heOU9q7nlwiIiREk 5yDidWTTs3lFjCZLU8PMMNcJ3nQWYkiwYbSDV5IeD6ri/ArlXxhKQgv2SfPpaFIOgYl1 tY6cvteNfeTaUi5sESFQt5WLb1v9vPFaAshrEf8tSpf01/llL4TH6Fw41GCXNuuGdEZR /1MUWq0pmwro4+k29aOcVzWd0O2JxCsBang3wPxMKJAQ3yYe9hADfwvzjoCfACZdN5RZ SDRZK7qDAsEMNf8cgmtESUZy8q1HrOSoMZBjmC7G032Eon4eLigvFYkYOt/tN57Yzz08 bptQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P6HSTBj8mmPeZRpWo8jeAdM3JIm4llQZnyUKHBtFk6s=; b=FaLTYXyz7Bx+wUugG0TrcVgtzaXeibqfQl6PDHBU1XfQSXnh3gebITdGe8ymVTl9vC D0wkGw3h1mkZCgOYQE1XplZc2P7ihOotC2vxbI1E98+H3XNJg9E6/vpB3qa1iwD04XQX qiOr1hlxeC7sk9KrUw/UnKhD+Vd4U57OzAho4de3vq4CDjaV2zmfEctP2RisHQAQSTJ1 clQW2W4XjYISmPBdMKiZkTXlPjfHC1fcq3wiGk0On0iiC0Qc/jr7mGji5LyLGnmrerC/ CveQ0k1Mv0ypt8kmHyd4J6hpmieELAqLir1NxU4ZdFyv2s/1PqYSSgcI/2QhRwWRQHYM yriw== X-Gm-Message-State: AOAM5334ASc5Um65S3qYlUldCH7Eu4TpMRr+NiTW2waKr5anvyFmQdUh 2tMhnLyuxkmNvyP/fRcrhP/fiHqHhmuoow== X-Google-Smtp-Source: ABdhPJwnOWcXHbxFfDCsN/WE4mHztXJweBsejnyvD2DUw5NIYVdA4QTX+ThxK5aKfdebjClzNDGIlQ== X-Received: by 2002:a1c:6805:: with SMTP id d5mr25892039wmc.19.1593610542682; Wed, 01 Jul 2020 06:35:42 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:42 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 10/13] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Date: Wed, 1 Jul 2020 15:35:01 +0200 Message-Id: <20200701133504.18360-11-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_state()` shell functions in C and also add a subcommand `--bisect-state` to `git-bisect--helper` to call them from git-bisect.sh . Using `--bisect-state` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. As more functions are ported, this subcommand will be retired and will be called by some other methods. `bisect_head()` is only called from `bisect_state()`, thus it is not required to introduce another subcommand. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 87 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 55 ++----------------------- 2 files changed, 90 insertions(+), 52 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 3ded6a0ea2..ef8121afc7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -31,6 +31,8 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-next"), N_("git bisect--helper --bisect-auto-next"), N_("git bisect--helper --bisect-autostart"), + N_("git bisect--helper --bisect-state (bad|new) []"), + N_("git bisect--helper --bisect-state (good|old) [...]"), NULL }; @@ -856,6 +858,81 @@ static int bisect_autostart(struct bisect_terms *terms) return res; } + int mark_for_removal(const char *refname, const struct object_id *oid, + int flag, void *cb_data) +{ + struct string_list *refs = cb_data; + char *ref = xstrfmt("refs/bisect%s", refname); + string_list_append(refs, ref); + return 0; +} + + +static enum bisect_error bisect_state(struct bisect_terms *terms, const char **argv, + int argc) +{ + const char *state; + int i, verify_expected = 1; + struct object_id oid, expected; + struct strbuf buf = STRBUF_INIT; + struct oid_array revs = OID_ARRAY_INIT; + + if (!argc) + return error(_("Please call `--bisect-state` with at least one argument")); + + state = argv[0]; + if (check_and_set_terms(terms, state) || + !one_of(state, terms->term_good, terms->term_bad, "skip", NULL)) + return BISECT_FAILED; + + argv++; + argc--; + if (argc > 1 && !strcmp(state, terms->term_bad)) + return error(_("'git bisect %s' can take only one argument."), terms->term_bad); + + if (argc == 0) { + enum get_oid_result res_head = get_oid("BISECT_HEAD", &oid); + if (res_head == MISSING_OBJECT) + res_head = get_oid("HEAD", &oid); + if (res_head) { + error(_("Bad bisect_head rev input")); + return BISECT_FAILED; + } + oid_array_append(&revs, &oid); + } + + /* + * All input revs must be checked before executing bisect_write() + * to discard junk revs. + */ + + for (; argc; argc--, argv++) { + if (get_oid(*argv, &oid)){ + error(_("Bad rev input: %s"), *argv); + return BISECT_FAILED; + } + oid_array_append(&revs, &oid); + } + + if (strbuf_read_file(&buf, git_path_bisect_expected_rev(), 0) < the_hash_algo->hexsz || + get_oid_hex(buf.buf, &expected) < 0) + verify_expected = 0; /* Ignore invalid file contents */ + strbuf_release(&buf); + + for (i = 0; i < revs.nr; i++) { + if (bisect_write(state, oid_to_hex(&revs.oid[i]), terms, 0)) + return BISECT_FAILED; + + if (verify_expected && !oideq(&revs.oid[i], &expected)) { + unlink_or_warn(git_path_bisect_ancestors_ok()); + unlink_or_warn(git_path_bisect_expected_rev()); + verify_expected = 0; + } + } + + oid_array_clear(&revs); + return bisect_auto_next(terms, NULL); +} int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { @@ -870,7 +947,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_NEXT, BISECT_AUTO_NEXT, - BISECT_AUTOSTART + BISECT_AUTOSTART, + BISECT_STATE } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -896,6 +974,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), OPT_CMDMODE(0, "bisect-autostart", &cmdmode, N_("start the bisection if it has not yet been started"), BISECT_AUTOSTART), + OPT_CMDMODE(0, "bisect-state", &cmdmode, + N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_BOOL(0, "no-checkout", &no_checkout, N_("update BISECT_HEAD instead of checking out the current commit")), OPT_BOOL(0, "no-log", &nolog, @@ -968,6 +1048,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_autostart(&terms); break; + case BISECT_STATE: + set_terms(&terms, "bad", "good"); + get_terms(&terms); + res = bisect_state(&terms, argv, argc); + break; default: BUG("unknown subcommand %d", (int)cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index cfb05c0511..7a8f796251 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -39,16 +39,6 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" TERM_BAD=bad TERM_GOOD=good -bisect_head() -{ - if test -f "$GIT_DIR/BISECT_HEAD" - then - echo BISECT_HEAD - else - echo HEAD - fi -} - bisect_skip() { all='' for arg in "$@" @@ -61,43 +51,7 @@ bisect_skip() { esac all="$all $revs" done - eval bisect_state 'skip' $all -} - -bisect_state() { - git bisect--helper --bisect-autostart - state=$1 - git bisect--helper --check-and-set-terms $state $TERM_GOOD $TERM_BAD || exit - get_terms - case "$#,$state" in - 0,*) - die "Please call 'bisect_state' with at least one argument." ;; - 1,"$TERM_BAD"|1,"$TERM_GOOD"|1,skip) - bisected_head=$(bisect_head) - rev=$(git rev-parse --verify "$bisected_head") || - die "$(eval_gettext "Bad rev input: \$bisected_head")" - git bisect--helper --bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit - git bisect--helper --check-expected-revs "$rev" ;; - 2,"$TERM_BAD"|*,"$TERM_GOOD"|*,skip) - shift - hash_list='' - for rev in "$@" - do - sha=$(git rev-parse --verify "$rev^{commit}") || - die "$(eval_gettext "Bad rev input: \$rev")" - hash_list="$hash_list $sha" - done - for rev in $hash_list - do - git bisect--helper --bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit - done - git bisect--helper --check-expected-revs $hash_list ;; - *,"$TERM_BAD") - die "$(eval_gettext "'git bisect \$TERM_BAD' can take only one argument.")" ;; - *) - usage ;; - esac - git bisect--helper --bisect-auto-next + eval git bisect--helper --bisect-state 'skip' $all } bisect_visualize() { @@ -187,8 +141,7 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 state="$TERM_GOOD" fi - # We have to use a subshell because "bisect_state" can exit. - ( bisect_state $state >"$GIT_DIR/BISECT_RUN" ) + git bisect--helper --bisect-state $state >"$GIT_DIR/BISECT_RUN" res=$? cat "$GIT_DIR/BISECT_RUN" @@ -203,7 +156,7 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 if [ $res -ne 0 ] then eval_gettextln "bisect run failed: -'bisect_state \$state' exited with error code \$res" >&2 +'git bisect--helper --bisect-state \$state' exited with error code \$res" >&2 exit $res fi @@ -244,7 +197,7 @@ case "$#" in start) git bisect--helper --bisect-start "$@" ;; bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - bisect_state "$cmd" "$@" ;; + git bisect--helper --bisect-state "$cmd" "$@" ;; skip) bisect_skip "$@" ;; next) From patchwork Wed Jul 1 13:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636425 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F990912 for ; Wed, 1 Jul 2020 13:35:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47E9F20760 for ; Wed, 1 Jul 2020 13:35:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MRfVxBWh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731177AbgGANfs (ORCPT ); Wed, 1 Jul 2020 09:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729332AbgGANfr (ORCPT ); Wed, 1 Jul 2020 09:35:47 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49FF9C08C5C1 for ; Wed, 1 Jul 2020 06:35:47 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id o8so22447476wmh.4 for ; Wed, 01 Jul 2020 06:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Npr/M7UuOj3UKyUGbMPYeV+rV5nr/9xAOEZN+JGZTjQ=; b=MRfVxBWhyz3lxIh5KPSAeNbJSEUjbxCFgtCfPYpw23EOWT43OLLX1g+JOxFsxWeNtY EVyvpmdQI0XdNW4iZRxfEmh8vW4NQwaqzEHMVQP3yOZZUQ8OIiIEf6LbWqvJl26vnzZG BezfhwPip8Zb7BeaEO9huUfbCIEIt5TsF3K8F/1leqzcFzc8Vz1phpM6LY6LtOy1s9Zq aLytNL0ksoKzgneHyIh4ciwc/K1+NNdxDY2A8KJb0tdSAgh5mcf9EYChGfVsCqNObkFd /8acsHg6V+khwED7+/Twdjrj80TKn1vCFq8meCapR8TVnU5K3Ivhvf14cJ4qUW5/zKEf V2jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Npr/M7UuOj3UKyUGbMPYeV+rV5nr/9xAOEZN+JGZTjQ=; b=JbiKeFSKV0TPvbFnUto3R3YfsH10wwOPVicI/O3NIqXQW7amCcgN7UoVlahO2vuJAh vS/D55IxgyY96WYu7w8XWLVnyTSry+OehcjUN0PBjRG9XzdFhlgI0AMEIk0eSmCEIpZe +20JIVnoJNgrWWXMJpljrvgmcC/7lOr2pHZD4YHd+TAVeaaXQ4xp74zI0rE0YNRWgMuQ unmiWpIOBjw4EDk074OiMMOn2PlyNGjbD3CQ08w73VsEFPgGdCI6+HNhzJ6NABpvIec/ hIW5WpG6ZrGMV9Ee2HW7B0n7BfSOtm9bTw1GxmmQvh8xx+bTZAyp4dzQBcqIuzu59E8d f7hw== X-Gm-Message-State: AOAM531PGHT1OYp4Yqb5fqV0Y51aKMQKGH0gVq+l6VaPKwrjXCnCTAp8 ljLoWd7tWzBbJ6BnaBd/3oh6MWoq7DWHAQ== X-Google-Smtp-Source: ABdhPJznuPIejC+FybMJW6Nh5nQaWS5+YKn4oYCYfegQUZxRXuACcv5OrOmKPNbjDSoZIp2LxuH2wA== X-Received: by 2002:a1c:2906:: with SMTP id p6mr26417446wmp.68.1593610544129; Wed, 01 Jul 2020 06:35:44 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:43 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 11/13] bisect--helper: retire `--check-expected-revs` subcommand Date: Wed, 1 Jul 2020 15:35:02 +0200 Message-Id: <20200701133504.18360-12-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--check-expected-revs` subcommand is no longer used from the git-bisect.sh shell script. Functions `check_expected_revs` and `is_expected_revs` are also deleted. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ef8121afc7..874f8c38c4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -185,30 +185,6 @@ static int write_terms(const char *bad, const char *good) return (res < 0) ? -1 : 0; } -static int is_expected_rev(const char *expected_hex) -{ - struct strbuf actual_hex = STRBUF_INIT; - int res = 0; - if (strbuf_read_file(&actual_hex, git_path_bisect_expected_rev(), 0) >= 40) { - strbuf_trim(&actual_hex); - res = !strcmp(actual_hex.buf, expected_hex); - } - strbuf_release(&actual_hex); - return res; -} - -static void check_expected_revs(const char **revs, int rev_nr) -{ - int i; - - for (i = 0; i < rev_nr; i++) { - if (!is_expected_rev(revs[i])) { - unlink_or_warn(git_path_bisect_ancestors_ok()); - unlink_or_warn(git_path_bisect_expected_rev()); - } - } -} - static int bisect_reset(const char *commit) { struct strbuf branch = STRBUF_INIT; @@ -938,7 +914,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { WRITE_TERMS = 1, - CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, CHECK_AND_SET_TERMS, @@ -954,8 +929,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), - OPT_CMDMODE(0, "check-expected-revs", &cmdmode, - N_("check for expected revs"), CHECK_EXPECTED_REVS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-write", &cmdmode, @@ -996,9 +969,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (argc != 2) return error(_("--write-terms requires two arguments")); return write_terms(argv[0], argv[1]); - case CHECK_EXPECTED_REVS: - check_expected_revs(argv, argc); - return 0; case BISECT_RESET: if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); From patchwork Wed Jul 1 13:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636429 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A5F9913 for ; Wed, 1 Jul 2020 13:35:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 018CA206BE for ; Wed, 1 Jul 2020 13:35:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hn/RgKGW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731174AbgGANfv (ORCPT ); Wed, 1 Jul 2020 09:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729332AbgGANft (ORCPT ); Wed, 1 Jul 2020 09:35:49 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9078EC08C5C1 for ; Wed, 1 Jul 2020 06:35:48 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id f18so15804269wrs.0 for ; Wed, 01 Jul 2020 06:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FuqbPT995bQBC22i6nIMpjMilS0Bnmx5rLqItIgpbfs=; b=Hn/RgKGWSvi/igpPsCh9Ugoq0v407LTOjNn4SXueQxe8JLnIuWru4GHAf8VIFZltvM 0gEF54mROEKRPpuPZ1ko+iWRyvk3wjsUNtAoi9mylR/8+QeX6O/E1BwHO7EQO3NYlWRs 7LRDv86Ykjj7kiR8PVkis2pOMSmr6foCRPdbcisii3jabok0jxigLaAcQ1LRlRE7o4TJ 5qNLpwgfBdvLVKK7JCc4XkIdvzErjHv7n77yc1YgGxzg71jf6ZFv88G8YG8I8FJ0TSDr 4wT/FLud4z6w85K6UTg57cz/+qOInocWjrY5Wgdbq9WdjK5t+Rw98J6Wlwup9ctQJ12L eFJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FuqbPT995bQBC22i6nIMpjMilS0Bnmx5rLqItIgpbfs=; b=tfhBM801wPGaJe9MIl4DpxulYWF8kN0RX5fCwnX8Eh+o4sUJvS9KY2orEMqh8L4/zX Q13qs4Nds8gQ4h5fj93edkMouK9UMF1Ae+DhIBWO8MPFFK8ARP21xTI9Id23DtLQRXgX PTsXXVwCau5ALZzSch36TYuItQNvogDgMav9uFU/blhwTVDoEtkXr81wFhsL3+66Tw3b VUdxayvKaTHLoFdhRM+6jMyD20I4slksOpfFEPAAVLXVeSrrFHOl91cx31KHYY3uQftP tqiRkTi2Zu/GW9WJGEXjFBqE7JTFoOAQZ0HE45F01/KKz/H+kGCzsrvUzrQrj7yFjILv Pj8g== X-Gm-Message-State: AOAM533h3jIyyumDo+jzR7VvcaixOngZWfxreQbFaZ9pxFlqnbj9BTRg JFy3zs35LJRCn0nG6dUiUfGHoaj3kpeeJw== X-Google-Smtp-Source: ABdhPJy4sI5J2jac3oReUjai6wz7jbPRXSS8sWCYBEc6w9MyT0NPJOFMmNcqN7p1IB1ZtK3axve9PA== X-Received: by 2002:adf:e60a:: with SMTP id p10mr25737369wrm.181.1593610547002; Wed, 01 Jul 2020 06:35:47 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:46 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 12/13] bisect--helper: retire `--write-terms` subcommand Date: Wed, 1 Jul 2020 15:35:03 +0200 Message-Id: <20200701133504.18360-13-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--write-terms` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `write_terms()` is called from the C implementation of `set_terms()` and `bisect_start()`. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 874f8c38c4..ca9d27b005 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_head_name, "head-name") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --write-terms "), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), N_("git bisect--helper --bisect-check-and-set-terms "), @@ -913,8 +912,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - WRITE_TERMS = 1, - BISECT_RESET, + BISECT_RESET = 1, BISECT_WRITE, CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, @@ -927,8 +925,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { - OPT_CMDMODE(0, "write-terms", &cmdmode, - N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-write", &cmdmode, @@ -965,10 +961,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case WRITE_TERMS: - if (argc != 2) - return error(_("--write-terms requires two arguments")); - return write_terms(argv[0], argv[1]); case BISECT_RESET: if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); From patchwork Wed Jul 1 13:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11636431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10485913 for ; Wed, 1 Jul 2020 13:35:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEE11207D0 for ; Wed, 1 Jul 2020 13:35:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VfSxQpLC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731182AbgGANfw (ORCPT ); Wed, 1 Jul 2020 09:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731169AbgGANfu (ORCPT ); Wed, 1 Jul 2020 09:35:50 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7296C08C5DB for ; Wed, 1 Jul 2020 06:35:49 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id f7so20854780wrw.1 for ; Wed, 01 Jul 2020 06:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Y/JPWZjlooegeuPzZAbvbNDZ80yoEyxQtQXJCYUFx0=; b=VfSxQpLC0OI+qYF/Ksga8WKtXyI55WAEG8Eo6npawc+UylJAyCwm3vPwlPk2ytFtG1 1HHlggYHyfoEbyjG2M64rFLHEQ6TDgaja448sJopkrSqQwQBFZ8Sy65hfDB0gOb2T+Dv gprWD+DiaODcEwJXfpqeNy1bm9EjtvHKLuorCYl2EuG55ghC8YilWxrq6GGiHs7c/ETg SbeCs9hbp+ZZC9pxx3bs/AihoNfGeQHcb4osv+uFYvLa4+MjClLSMRgRGz5Kqt/1tPpM N6T1QlNfehGeTr7utoy1kdeujnHnk7eO1bhDkllcxW2v0Ym9szL4NQKYOhhliUv6PEhI iyvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Y/JPWZjlooegeuPzZAbvbNDZ80yoEyxQtQXJCYUFx0=; b=mrXDAwFAiovOI5S/5EJ56AYhFusnL+Ih0Z2GzGQ3GpoqryacBhWR7KVFahHRT44K0G kyfm11Sn+7oCbWvC6VrEG6F/o9WuXwFot9MqFk3vAIBPzw8DbNk9uXCmmcWN0SOY21gA P0a56k79YJKt5wZ+zRoxF4WvOzRIEE/q59PfAXlfMYTWKWwDnGIvwXWl/I8iwMB/albS mgs3bpmg2qK2akV+1vyVoYrZyQrQ/Cs9aQBIDXMKOK2wpMZaoj4yhhKI8Wo/IkFfLLry KiAFuAlx2byUrOeU5Kw7Lph1bi/8KejZY/t4wue549LlYq+NlG8YC+zibrIeSAYdapPg 7mJw== X-Gm-Message-State: AOAM532wHAvDz+921eJuc2DPOMl381rB8RJ5QXab1DOpoWDnrH4ZWULm bB4kLbTFNhv+Q+AVP7ToFp06Vl66R4wfGw== X-Google-Smtp-Source: ABdhPJwBMb7vgHEpkE8r2QmGBZbc6hfMoEyhLheeEdWGOvNLRU4ukRuDDiSXz84cp4RdXaNchqmyig== X-Received: by 2002:a5d:4e87:: with SMTP id e7mr28402176wru.12.1593610548221; Wed, 01 Jul 2020 06:35:48 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id 30sm7928840wrm.74.2020.07.01.06.35.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2020 06:35:47 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 13/13] bisect--helper: retire `--bisect-autostart` subcommand Date: Wed, 1 Jul 2020 15:35:04 +0200 Message-Id: <20200701133504.18360-14-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200701133504.18360-1-mirucam@gmail.com> References: <20200701133504.18360-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--bisect-autostart` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_autostart()` is directly called from the C implementation. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ca9d27b005..7a9fa4de78 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -29,7 +29,6 @@ static const char * const git_bisect_helper_usage[] = { "[--no-checkout] [ [...]] [--] [...]"), N_("git bisect--helper --bisect-next"), N_("git bisect--helper --bisect-auto-next"), - N_("git bisect--helper --bisect-autostart"), N_("git bisect--helper --bisect-state (bad|new) []"), N_("git bisect--helper --bisect-state (good|old) [...]"), NULL @@ -920,7 +919,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_NEXT, BISECT_AUTO_NEXT, - BISECT_AUTOSTART, BISECT_STATE } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; @@ -941,8 +939,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("find the next bisection commit"), BISECT_NEXT), OPT_CMDMODE(0, "bisect-auto-next", &cmdmode, N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), - OPT_CMDMODE(0, "bisect-autostart", &cmdmode, - N_("start the bisection if it has not yet been started"), BISECT_AUTOSTART), OPT_CMDMODE(0, "bisect-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_BOOL(0, "no-checkout", &no_checkout, @@ -1004,12 +1000,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_auto_next(&terms, prefix); break; - case BISECT_AUTOSTART: - if (argc) - return error(_("--bisect-autostart does not accept arguments")); - set_terms(&terms, "bad", "good"); - res = bisect_autostart(&terms); - break; case BISECT_STATE: set_terms(&terms, "bad", "good"); get_terms(&terms);