From patchwork Fri Jul 17 10:53: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: 11669789 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 73FD213A4 for ; Fri, 17 Jul 2020 10:54:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55AEE20768 for ; Fri, 17 Jul 2020 10:54:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JxRL0Yhj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbgGQKyk (ORCPT ); Fri, 17 Jul 2020 06:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgGQKyg (ORCPT ); Fri, 17 Jul 2020 06:54:36 -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 E6EFCC061755 for ; Fri, 17 Jul 2020 03:54:35 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id a6so10526508wrm.4 for ; Fri, 17 Jul 2020 03:54: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=QGmK/o5MGnE7qfNy6OlJiuoXu3XIcEOXYJElqWDicLk=; b=JxRL0YhjFx2DWZAKXO/pmpsj4tW47ZO8caNY3Biua/urhWC9YhQ91vgXAV60RXMppr u0OuWz7bvorZYoe1gtmk1pAAYm4rO8m0xI6Q+6MJeIBHjYlTapLfqT/sbra0z7hMCBJt DHUJc70Ky++b/B1rSQq2MzRjbVPn/5ZaaHpz3av9oiag26r4BnCKy45OmJcpIy0XXe04 1fsjcbMatbV+GagGQ/feMi2KVdbLLfaiEEpiMkhvfMu1rnb8ufgOijF0M67ZU2jKF5kZ LdPFUf755J12a0W9/p2K9wrrzPZ70FnNRaEMOvzNISmutbFhJFdODcrh59Pzf4H7wzR7 2uNg== 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=kHe3+7i6ceEshR1BcfCYEAjooDEheKoBoPZ6MhPyJUKq9kYNGKSoJTEYsszcbYg1Bx M7oz3ahm0Ucub2VmTNNbKqTHinn4e7rX5ftXJ+vOj0B9K2Xx2c7VgP+NzjtXyPjfj+9D NwtItKDszmwmHhAiGxL/6Uz5Uelf6ItXa1yX1XQujnF2V4/tG8XjE7ygz1cZbLPDFRYa eCMOTvANCLnpnpbJNjzdLImXaPVcNA3j9SAaOmF53eSlzdjr8fGZMgCmofNlBqL9gI6i f7QbZprN+WBdSru4YcJbuyCrJtV6dQuy1HrmE+XBlK0nfi3p3jUzIMlaLAkegFcYQeMu xrJA== X-Gm-Message-State: AOAM530hZjFIKBZ6fu6NRQkhIyYxp4/hGef6G5zuwPFPq13NgWFAzl3d K45ZawvsAa+wVlKTPdMyP6bqd5zR X-Google-Smtp-Source: ABdhPJzbLSzs+yPFldTouLX3DYA2nRfPA43H1KAofVWsSDuCnXDfc63F7j185I9fK617laAwlVCGLw== X-Received: by 2002:adf:ec8c:: with SMTP id z12mr9150186wrn.281.1594983274432; Fri, 17 Jul 2020 03:54:34 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:33 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH v5 01/13] bisect--helper: BUG() in cmd_*() on invalid subcommand Date: Fri, 17 Jul 2020 12:53:54 +0200 Message-Id: <20200717105406.82226-2-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 Fri Jul 17 10:53: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: 11669805 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 231421751 for ; Fri, 17 Jul 2020 10:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 093392076A for ; Fri, 17 Jul 2020 10:54:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uHlHNuq5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbgGQKyj (ORCPT ); Fri, 17 Jul 2020 06:54:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbgGQKyh (ORCPT ); Fri, 17 Jul 2020 06:54: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 D74CAC08C5C0 for ; Fri, 17 Jul 2020 03:54:36 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id s10so10452431wrw.12 for ; Fri, 17 Jul 2020 03:54: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=2Y8RQWgTwF/RO1Uaus8CCVvUUfZv3gZ8SKcL2uuqtns=; b=uHlHNuq5vAsu/m84a6bxctyZlxFAx8kYFnoelf2ngxlgkJJPXWZ800dGLUoFFLq3o6 uVEZmRakYd9lC559mv/SJx48wCozEXMQ/ILOSUMK7DFC6Xtm3jtnMc8qbmFi0EqqKM4F Wq/n4dWUg0ZBHHecWW0T0eBaWqrzPiSiubgwI1TKvRtMVoGq2CpzBqkqwxC3L/InRrI2 cdw+cqqpeEa+JQP5O/kmT5eoP77eiTlQdXrAWwnclx/MC4hcQu901eAg5GjfhFNdJVr0 ySSGo6dLDxwK2kMT5wcsW6W9nrpC82wxBuA3TRvIdaMUHqNyXK8de0Ha6EkgqzzCPsKc 7org== 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=Bc5u9PnYdzpFvDdUbM4FEzaGqxi0rudcsATYSxhXXQextcPbMwFtbojvTtbm1AEXcq RO+txNulwysCeLme+FYy425Tg+0c77XB4ujlrEaXCrOU6FqlR2GnvOSbBETVpGpvU8dU WbnWspowyGprwG53y8Vmc4yWjohuwuVVfJynz6I/Cl89Q+DL9E73BcYYPkRVertCz3Jr m4eoES7Sc2iB37nFbm/tq7sZFfHLHTnUVUFK2OOGlEE0/ZcNCpYzKWA37VoMA0nzgjCP q8lxuzGatVQV/QY6Ok8XNimPkRONtv9Lame+idKCPyXZH9bWs3PQ736S1ivXmhlOz8Xc eX8Q== X-Gm-Message-State: AOAM531tSyJDRjeVBp6RhQL0+bVdTvrEr2sjlFVy0lLuMgQBQwUGGcnN D/wE0w850Y+1/3Xd5ck9zNNC9QrX X-Google-Smtp-Source: ABdhPJzWngrSeUejuAKCDRPz2llDLluj4hCbhwzPhFHGSgrqrnyAYk3sLrtnN+9/tCEjrBGvPf4/0Q== X-Received: by 2002:a5d:5273:: with SMTP id l19mr649881wrc.257.1594983275406; Fri, 17 Jul 2020 03:54:35 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:34 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Junio C Hamano Subject: [PATCH v5 02/13] bisect--helper: use '-res' in 'cmd_bisect__helper' return Date: Fri, 17 Jul 2020 12:53:55 +0200 Message-Id: <20200717105406.82226-3-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 Fri Jul 17 10:53: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: 11669791 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 7A38F13A4 for ; Fri, 17 Jul 2020 10:54:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60FDB2076A for ; Fri, 17 Jul 2020 10:54:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uwa3S2bP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgGQKyl (ORCPT ); Fri, 17 Jul 2020 06:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726439AbgGQKyi (ORCPT ); Fri, 17 Jul 2020 06:54:38 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB15EC061755 for ; Fri, 17 Jul 2020 03:54:37 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id j18so14183427wmi.3 for ; Fri, 17 Jul 2020 03:54:37 -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=jJwxte9VsAu3DBl1IXtcz1vAHjteLgjRLan4d9CeGNk=; b=uwa3S2bPW5eUXi1zZM7560+i9cDe4QbyRFdwTrGhffuntUVyz5qMGUQWE/RNYHkV0Z DwNBCdz8MWn8u+iNo9ANb1wB2dY2bmeHdVJhmGWZbHKE5902nH/7qhpewtnGJNV+RPfQ hUBohP8EW5DWOYHTtkH4I4B/IWgFuQynccWkdBmvhUBw6S5wi7mJ4rzVqGqOomUB2x4e UnqdsE1jsSPquKnjbtfY80LAVb9Ond9DB0fM+Z0F+7mPXKCdmUf++oVhCWGq3hY7vtqn mIJX7m9/qDfh/SmWOVaNAo0r8QjIGXZ3HDx1fpih/+Igal0JQaJX6l7SgyVjSX/TG0XZ gh2w== 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=jJwxte9VsAu3DBl1IXtcz1vAHjteLgjRLan4d9CeGNk=; b=RXOAoO3ydQLYa1xVR5zVRkgH5A3/HDtsSeQOf9zmOeQOFjM2PlDB12hG89U/3ws/Ny un0WPSWcbXUb70fkgIrRI8V2zeVJgsG7h2Ff4TFF8eaU2M8AQVkN7yRE5gzXY8LQig// +W9Z9s5dWY1SYfXJRZyA6NinOjtP7VlP/GsL41GIXfQ0H7SPHrFrib8WMx0+G3F0e4r1 xi17jYLvCVbZ0Vfz0VpRIhZ0s5LuOHsCjNyK1zt2OYwBkdXNQlKrOmKC4EB17ByGpHV9 WJyeHxt2+c7h74tz8C+aJOD8zFoQwzQp/QJYNCPtP+BKcvMwXqbxjOlAfj0VXQZTn6zd hmlg== X-Gm-Message-State: AOAM533uSI4KDJT40OC+vNlPmo3txIqQvV36c1CiRlU5XV0X/1Vj/6Ia BSuKskzMdA/6kY7HOi86+GIbaMEX X-Google-Smtp-Source: ABdhPJzORbCN9j2DxCSXKqxMMP/tmN96JOXP5brgVFHW6Mql7eC2T6zyrb7HBNukvJSp6sol4q1vWA== X-Received: by 2002:a05:600c:281:: with SMTP id 1mr8862400wmk.143.1594983276406; Fri, 17 Jul 2020 03:54:36 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:35 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH v5 03/13] bisect--helper: introduce new `write_in_file()` function Date: Fri, 17 Jul 2020 12:53:56 +0200 Message-Id: <20200717105406.82226-4-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 writing 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 | 41 +++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 0466b07a43..d620d84d92 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, "w")) + BUG("write-in-file does not support '%s' mode", 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 < 0) { + 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,13 +144,9 @@ 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; + return res; } static int is_expected_rev(const char *expected_hex) From patchwork Fri Jul 17 10:53: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: 11669795 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 C4D3A13A4 for ; Fri, 17 Jul 2020 10:54:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC720207E8 for ; Fri, 17 Jul 2020 10:54:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q5DWbi7g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726563AbgGQKyn (ORCPT ); Fri, 17 Jul 2020 06:54:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbgGQKyj (ORCPT ); Fri, 17 Jul 2020 06:54:39 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C1BC061755 for ; Fri, 17 Jul 2020 03:54:39 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id f2so10494255wrp.7 for ; Fri, 17 Jul 2020 03:54: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=cVqZSgXxypSKFkwgBgn8iwzajRNejPvHwTMkSfXEo6k=; b=q5DWbi7gNimemYrdYwvBz51KiqRG13TPAH/pIzpayHsJfhIaEV7pFQ4w5K05jzENrq wLJAEVigtQaxhl+5aqH2o6/BxLPDOXWNt/MNe6063sintL8HJYBW2dT3ZDtcaTxz/qcj KBmjrwNjH0EZ1cVWcXRRJSQBBQXOSjQj2DhWjVyVzyOETabswtxFKi1+j5+8EfNnNJFw +JCKoWeBUuuKnslcG8NHGBGQIJXyOtp1WQrxhVbZr+ENoECwWX45w/z0v1yF9JlgV27z Djnh2imeEhxuK8b9HWZ2Jk275mtSYxi/WsvihY784BicDB/2RA2UmjvnOenPIKbLDtuZ fL3Q== 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=cVqZSgXxypSKFkwgBgn8iwzajRNejPvHwTMkSfXEo6k=; b=GDpDx8tnIAsqnKz3HuLHCTs5JApTuN+ue9EHcK0eXjvVZ6+kEt5YH+4FEiOdWGagPd yI7cqAc/nrQan9oKBOyyOvxyW+zBHEKgwNyjNHbePaYcOdY5ltC/u/GAhHYUfeNHgXny FE7IAdjb5ffvVN8PAM/wUsVPgpCOxz+gSs/qxDdYq/7TrDVWCo9bklxE+n9wxDhdgzll V2g88lLMfUyukMtza/mPT1HZgRqhYCuRlV2k0Xv+JIM6afk4Gd9dWRrDWU4sT03Gg+FM 60Ha6LIl2yCOGFW2UHaxAZUVEuwpHTgvNb3iw5sel/c3uGik8qEdLbJJP9/7J2rEfyqC ixpA== X-Gm-Message-State: AOAM531ViXH9h9oZWIowjUpDZRLRVlHDz9SoTiKRNASsSvWbXtGfJgvq Fu8WpLvwcFU+fkSw88qSetgU/tef+s8= X-Google-Smtp-Source: ABdhPJy9fuzq5OvCniIWR+kiQfv7gRpdgdqJePXyqK0CGVCFcLSaRqyQmNS64FfzTp5px8y072ecgg== X-Received: by 2002:adf:eecf:: with SMTP id a15mr9760424wrp.83.1594983277580; Fri, 17 Jul 2020 03:54:37 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:37 -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 v5 04/13] bisect--helper: reimplement `bisect_autostart` shell function in C Date: Fri, 17 Jul 2020 12:53:57 +0200 Message-Id: <20200717105406.82226-5-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 d620d84d92..7662ec0ce3 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 Fri Jul 17 10:53: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: 11669793 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 22858138C for ; Fri, 17 Jul 2020 10:54:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F232C2076A for ; Fri, 17 Jul 2020 10:54:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QQHhLJkN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbgGQKym (ORCPT ); Fri, 17 Jul 2020 06:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgGQKyk (ORCPT ); Fri, 17 Jul 2020 06:54:40 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8402C08C5C0 for ; Fri, 17 Jul 2020 03:54:39 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id f18so16361084wml.3 for ; Fri, 17 Jul 2020 03:54: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=yJBqQyCyaifjDmIyIOSXfw9cRsG6/XuqaQklreu6lS0=; b=QQHhLJkNFinu9sOENnWFbMoW9YZFr7A4TqB6isAZ0s/k+bmd6bt7vHGnU7UPRuyRDh I594ZoBaaih2HPSew6ZAH8rjIg4pWKmmQOywPxqpmaP3EacneXj5seR1FjrejCo7IiK1 3mkEgoyiCVJesU7R63n8hG8RyDT+N1n54ByQF+smBFbK7aXKVOkDVqwV+R8PPFS6zcNL 5MiusVoKe8TiYBLlkhF0ZukxvBJ9JNiMbALs0monQKJShgToKWVudNnP8pV1a0sbJgeN yz7ELPDKz/lXt3zqjInllun300wlgxbftNMfVwZnOotb2untFoAcNXvcujmEBD4Vf2oU zccg== 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=NnPWlBediiTtnOs399eYgjkIs+TIzsy99KaPg1s22+2cm3/V7TQgu0IWtlM7uk32Xj JE7QXJciKFIZjZcUS8jfBCny+ZglR0YDK2JuDl2tlZlmaIQ5qkImoV4u2Lh9qwrukjIl Wtzvtxw+2L1pFWM5yThpRnSDj1lkP6nvSQ+mbBO+AHebbenjADbq2F0QNfyEjHreyWJ2 lBTF4N6fY7Ip3Y08NaYs1fNkTcon12bCE9NutVzHbz9oNQJ+BM0ViJJldrxkp1bUt5Jq JBkbP3nErSkXG/k63UwJZZbJqmLy9bMtAOsQ5xrcHNYydMG3+9xgTDJx4SfdjoxpY/sl wmhw== X-Gm-Message-State: AOAM530d2bynopn1MGC9rN/oSpELMHAhVL6l9u/8hk2he80xF21PUBrF 9jpqvIWOnJcJctu6lZ3lcP8DG3fL X-Google-Smtp-Source: ABdhPJyLVxRWfqroKPVOLevOWMteYH/5xirs+Pimpcz+3KczWtjjrs8bqwBEDOhXW3U6F+gex7yRzg== X-Received: by 2002:a7b:c94a:: with SMTP id i10mr9107654wml.183.1594983278407; Fri, 17 Jul 2020 03:54:38 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:38 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder Subject: [PATCH v5 05/13] bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()' Date: Fri, 17 Jul 2020 12:53:58 +0200 Message-Id: <20200717105406.82226-6-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 Fri Jul 17 10:53: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: 11669801 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 EE96E1751 for ; Fri, 17 Jul 2020 10:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD886207E8 for ; Fri, 17 Jul 2020 10:54:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Luc+nByc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbgGQKys (ORCPT ); Fri, 17 Jul 2020 06:54:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbgGQKyl (ORCPT ); Fri, 17 Jul 2020 06:54:41 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62A74C061755 for ; Fri, 17 Jul 2020 03:54:41 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id l2so16423943wmf.0 for ; Fri, 17 Jul 2020 03:54: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=kwmONcv11IcuW0c7J637OocMm6laDXOxGoO4GbPKO3M=; b=Luc+nByc9EB40h5B6iBxdcC/8wD0x3ihFqQqdTTIwpSE9ZVattRZdEv/ASg8t0H3BM 2rzRfKDWJl+myxN5D0oKawiDW3X0abQB/CbCb0nSgRFvdwZoPZZq7j4YX0pMgoRJTds2 /NFSbr/ucdtBznMLFAX+hp5qbHN0+FdgMls1rnQn6VMm2uoJpuuZ+9vRdfbXen061PUn mXuTdvxYraVS0ouY6+Q/t9fSDccI4/4+niTm9er02DVo5Q/7C9gVjq4MEFI8C8cCK4T+ 6TQ3gphaM0kwjShCEaMNkyAjrBjm1JMTS+06anRlZFGe/17cCFdZIsTpjY/2YPKCoKZ1 oT3A== 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=kwmONcv11IcuW0c7J637OocMm6laDXOxGoO4GbPKO3M=; b=EpzcqooCTYu5/mCHLqDPJqGK0pG1fNkdxkuHjco6kYr/f59nscgS6Eq/uB3BD0AcKp EGRNrW2rexnscJl0yfhK+z5erkQlxrTOIHofCJUbzaatrsJtrR//+pCK97KGnRtjZ90b /jlCFQ0kB1BVizfDYqYZdf+IRmZiliVoC7DM1cRyIq3unQIHo3N+zCTEFhszJrf57nw9 Vc7WAVhCkaxO3pNyJDlxAagGjdTGRTsPkJG+dbr2zqj/DGRBxVGr2CEKrSh0AW15wNLa kKXc8mKYa7CNq9j2nDtsFX8gvCM0LpUmfWXKTK5k3fmuuvNZ4knoPqefrM7yM5peCGgX eKwQ== X-Gm-Message-State: AOAM530UkkzR2bEfrB2Ri28jaiNA8noG+dUqp+Jz/XKnV+N3O73q/EDK vBpIhrXEKU6q+CkSwD4LuVgwuPoCHes= X-Google-Smtp-Source: ABdhPJx/596gMoHYKBAdbFMchKTZXmooop3jae6+x13xqzcfIfzwpgDrA/5oQDp83HaRv0dSbeym3A== X-Received: by 2002:a1c:1f54:: with SMTP id f81mr8633181wmf.4.1594983279521; Fri, 17 Jul 2020 03:54:39 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:39 -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 v5 06/13] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C Date: Fri, 17 Jul 2020 12:53:59 +0200 Message-Id: <20200717105406.82226-7-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 | 183 ++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 47 +--------- 3 files changed, 190 insertions(+), 46 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 7662ec0ce3..4223af144a 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. @@ -80,7 +90,7 @@ static int write_in_file(const char *path, const char *mode, const char *format, FILE *fp = NULL; int res = 0; - if (strcmp(mode, "w")) + if (strcmp(mode, "w") && strcmp(mode, "a")) BUG("write-in-file does not support '%s' mode", mode); fp = fopen(path, mode); if (!fp) @@ -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 Fri Jul 17 10:54: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: 11669799 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 77C76138C for ; Fri, 17 Jul 2020 10:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 599162076A for ; Fri, 17 Jul 2020 10:54:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KWYOLUjb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726626AbgGQKyq (ORCPT ); Fri, 17 Jul 2020 06:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbgGQKym (ORCPT ); Fri, 17 Jul 2020 06:54:42 -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 8F9F0C08C5C0 for ; Fri, 17 Jul 2020 03:54:42 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id s10so10452694wrw.12 for ; Fri, 17 Jul 2020 03:54: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=oOHI/uijrXArtHoXPNf+2CT7KYSXOpthnmTBYy4hSzM=; b=KWYOLUjb5T3o35ZTz0NXzIXbxpqWUwLCBjd6MhKxnBRaGCxK8ToBmzC+L8U/07NH7M v5BgNpMoQXFQXi6oXcerLy8kW+5imOhrRTgvvpQzUN1//WSZo/unvdA5xbT3mxihuJGi UR+EYGs4CTEo6gt4MCIE0Mh4ypCANwMiXFVnqmRAQIVVOsH8u2eDNoRTnr/P/N+9xO4g kNkN24jKjQ4d5+vDGXeYp7+G6/HSOfL3fZuomc2d9tUa1BYiw+5M8Up6bLQYrnIMASsd 5qcWWR0NeYFSwj5fBU87pSrSXNAVl7zp/olrUjBX4PicaMUK54KbHFxBbhjOUwD300UV vq0g== 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=oOHI/uijrXArtHoXPNf+2CT7KYSXOpthnmTBYy4hSzM=; b=tDDhf9CR6hpH0ObtROMtwwYZj4ULDFkl/nYZXKWl4I0ro2EOSb6YIdE2Wf9bW8Zaz7 bUMKe0MHajvRg+gHZiny60a8rDb43Otdt1k+Ey5qgADUwWCOCSrnaSvPmZCPhJHNhJsD 5O97/S8I2DB2B99xXdAAgfy/x7AekG47IEjAm4EsPnvqGW1hFeOy98VgPUVZAjDIVOAZ KzBGLLQ9wRoDFeJC3WGYeTIHEvtJ59wSwPRuzRm29dcarHCvuKjbE5YHeq78AktnoSvi qUho0fNOlGni+P3QAncdy/CoEa0PLXfqfcjAdQUTswkWDAPU84ACW16mpfUeld1kvfU4 5lAA== X-Gm-Message-State: AOAM530gDh/e7u7fBcVKH67DWDRSf/OmRbbiGxTWmYeVRaetij3nBj6t SCpP13ZF4S5xdDnpl7SzLNKEAIU8 X-Google-Smtp-Source: ABdhPJwWvHhAe8mP13gUuIhoP8GQSh4u5e60t3dkgfaDWP0k3MJXROHe+MMvzzt0YYGaAXa1r2YhZg== X-Received: by 2002:adf:f14e:: with SMTP id y14mr9626377wro.151.1594983280990; Fri, 17 Jul 2020 03:54:40 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:40 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 07/13] bisect--helper: finish porting `bisect_start()` to C Date: Fri, 17 Jul 2020 12:54:00 +0200 Message-Id: <20200717105406.82226-8-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 4223af144a..2b7bad558a 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 Fri Jul 17 10:54: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: 11669797 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 C758413A4 for ; Fri, 17 Jul 2020 10:54:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC4742076A for ; Fri, 17 Jul 2020 10:54:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sFeBsgj/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726593AbgGQKyp (ORCPT ); Fri, 17 Jul 2020 06:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgGQKyo (ORCPT ); Fri, 17 Jul 2020 06:54:44 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDE5C08C5CE for ; Fri, 17 Jul 2020 03:54:43 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id w3so16372503wmi.4 for ; Fri, 17 Jul 2020 03:54:43 -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=0kviOj2gVA7cJvrLstGMSTiWT6uX82jRGwEC0u2kn4A=; b=sFeBsgj/nzcgJfVPDsWpxe9e76K6I3wmDjxCylfPHjBVSiOBLzyrK5iKlFMCMoKa0C 00hmhMNiHnz2f+RY5T8VvL3E1RZSJZa3F32MvwXkUgbuSLovPGRDH63gL9hEWnivkXO7 mGYHYx1XMyU5q3It6UwvnHaOeXAerGjTY1uKvJ3m9xDRrVsP1fwihKQ7vFLZyK3cIltX qovTQZt8a4fCDevOFCCdOH7+PIpikDC89ApAiBMT5b8b8xkNgFDC8ixvezT8F5u/GfQe J967ua4Nq7k5Dl9xoVrPwYUCI5j2+Lb8lTLBxC+UmwOPeWtM4zX+CiTRgSjQhfb66pyp 2EAQ== 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=0kviOj2gVA7cJvrLstGMSTiWT6uX82jRGwEC0u2kn4A=; b=lgdRfpdZTEf07dXIjsfRKAeE0i5/2HNUPI432s1S6H2IC3TZvg3Fb6k7YScqqL0qF3 ezz1DsemZFiLN5Wl5vcqmcVvbvFxl0hREpyAldh5hO4ToNny9l/dS7R6CJ5OY8Vtv5Y5 dEwYMCJHwj0s/61+63H0LvPXM5oGe86t7cJ9bWf5vurT1zs1gXjaHhEV0DRwvDUmK7SY JEJdAlpnwcEgdFdbThuSXDYRLRddLKVOekEnWdJm/8F/O3O0B+lWOzS51J6gBV+erJkd 319FSCflh9wexPZzt7lCmMoLguxjSnoKi3qXhg3uK+jqYT53Sb/jRg4to7KbdZaZK2dx TooQ== X-Gm-Message-State: AOAM531NgA8cMKCqIJht2KNBrCV/p/ITfWtaGn/fxqLwb9INn9TAosDO OB5PvXSjhLYfTpJssyaNDrlqtymX X-Google-Smtp-Source: ABdhPJz2wrTemiRhKF1oGG0wqx6hq9yfTjgPVDv5ilOwPkltDYHDz0NnWwhe7KSL6Lmb7UKAWKzKCg== X-Received: by 2002:a05:600c:4114:: with SMTP id j20mr8532112wmi.74.1594983282039; Fri, 17 Jul 2020 03:54:42 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:41 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 08/13] bisect--helper: retire `--bisect-clean-state` subcommand Date: Fri, 17 Jul 2020 12:54:01 +0200 Message-Id: <20200717105406.82226-9-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 2b7bad558a..a8742dc37d 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 Fri Jul 17 10:54: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: 11669803 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 CC03B13A4 for ; Fri, 17 Jul 2020 10:54:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A981E207F5 for ; Fri, 17 Jul 2020 10:54:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z7rClZnU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbgGQKyt (ORCPT ); Fri, 17 Jul 2020 06:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgGQKyp (ORCPT ); Fri, 17 Jul 2020 06:54:45 -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 9CEE2C061755 for ; Fri, 17 Jul 2020 03:54:44 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id c80so14194369wme.0 for ; Fri, 17 Jul 2020 03:54: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=/qIjWfT4mtBFleFBV+pP34DT95UJ+LOk41nFSdQcsqk=; b=Z7rClZnUTidt0v7RBHU5Fz6d2qU5vpAT6r3cMOPz1ihPE8frVV8kd3d15QCgAKKPFj I8U503Idk5bxXLJnzthjMUF2EUhm4iWzkazWjL+N8SnqpPfkkZsoRhHIdYfHhF70HbND XTGYkCwhdEoIEd3qb0yRLLzZhSzl/zBxQNNjNOg7XO7b3uCdogn7Bq1L2DvrFNWYnkWZ q2hWJocb2uCatHpDZt+uBHGgcNoENXtYNfCsG+U4fbO3h+Li1jjdIPIkz1z8n+bjOm/x AhflepOgpJuQN8DI7eONdKZYUaiaxYEEsHgcuhir8nSX7AjuE5MJH9heZ9PAT0euBmN/ cJWw== 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=/qIjWfT4mtBFleFBV+pP34DT95UJ+LOk41nFSdQcsqk=; b=UfG+1ACSKDRClQHyzWv8EaUKcxW7d0WSfUnv2Do9Fj/XyOcRGuq6POIQ9bEecpwkzl DlmCIY7D62sxb5Rc8P85iaG7O14TyvrII8rUE7XVExInB2GbvbZHdzifgYRxM6eixt7+ evWBYSxGmk+KS+gZX6QK+he10HOsPi8j2WLG3xRnAi/zwA0V8BXR4BH703mqt0BD/npl zt+EZ5ZRCVsFPFsCzVhT1jh/BexdUj6wt35+CHoUB+Knr670yZLHLtihvE4ME9s4Cz3h aI9AzVSW29Is9NP95PTKAl2yEh8YEZy2ZpEtIJc/zlGVGAPjeZ8nqBhqTfsHadL1bk73 D/4Q== X-Gm-Message-State: AOAM531TbHjEDHiYXnWar9e9VlbfZWIXCdZEVHtCJbpy+Jf0cTR+W4MK O8YNn4A+jM/hf1EfeVfx0wMqzaX2 X-Google-Smtp-Source: ABdhPJwTMxspBquHbSsJiAYIGlsBfspMLRIhZV3aHKt6AddYLyNU+uteQsCs1Qkp6NryLwhhgbRQ8g== X-Received: by 2002:a7b:c921:: with SMTP id h1mr8151316wml.29.1594983283197; Fri, 17 Jul 2020 03:54:43 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:42 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 09/13] bisect--helper: retire `--next-all` subcommand Date: Fri, 17 Jul 2020 12:54:02 +0200 Message-Id: <20200717105406.82226-10-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 a8742dc37d..fc6bf36e42 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 Fri Jul 17 10:54: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: 11669807 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 83C6D138C for ; Fri, 17 Jul 2020 10:54:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6325B2076A for ; Fri, 17 Jul 2020 10:54:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YxvKBCn8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbgGQKyx (ORCPT ); Fri, 17 Jul 2020 06:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbgGQKyq (ORCPT ); Fri, 17 Jul 2020 06:54:46 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 005E8C061755 for ; Fri, 17 Jul 2020 03:54:45 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id a6so7011567wmm.0 for ; Fri, 17 Jul 2020 03:54:45 -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=dPGXp2ryD4GzRgkCAFTvUG/JRc+vz1jNmIc9OkBJH1E=; b=YxvKBCn8AjtZ2QHUJMBihGsx4MjQEWzQ94Pxiaoeuu1KhmJpIEiMFdEw7WcVWQJLCz /ttTToBj+mGsg1Z8us3n0UX7vfCwYNA4Q28Ldgwohekat7425o+mE0Y6nApWdEqY9W4j wpLiUaxGs0QmYuvJJ141obTjC9RU8bqDgo+NS7P37BlYXr5hKHxacw0iyliNPGb3zwYr XzGB0wbwpBxMAnq6XqyKKoY93/nebwlzlJhA8qdFfASn6xYxPriTywg5z2vnMFZhnmNQ EpfCfIJ6rbZg0ck/fifxk7tL+UomhoSREOE+dgkCrCjlbVmBB3gdaowTReXk19xfQDVA AnXQ== 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=dPGXp2ryD4GzRgkCAFTvUG/JRc+vz1jNmIc9OkBJH1E=; b=adMj3kfncoDsBRkRAIiHoeC/u8UoKSe3lxamJVkBaYUk3Bu42uDBDnv1M36i4GxhCR g3CqlS0pNHD6ykex6rcrraKvxlq19LXWdDwM3bc7NFMItAboUCNcOettitnJu1I3Wwq6 2Ibpjn6A9KFo47WDamEXhKtLI9tlUN2rOxeOJj+KvD0iGbpX3j14lg3zfTFrFPmezRCq l0+fwcCqJG6wyzj9hdEDfcJDMYpIvh/XBH0rEnMXTZEd5/elqgZzBcQA9izh/r82nIDl 6vE4tqRR8ALvXcHfHgEnB9J5jxe3RIE4spUH7DfsaNIqy6Yfj0xhYm5uUMURX64qiQ7w BTzQ== X-Gm-Message-State: AOAM530iu1/qRcvLjFnpYWpv2RSfQH5EXtlr1SI7gMRCdunTl+K9jNdb ybloLZDPdgDdbGD4wGIVNH5dYA35 X-Google-Smtp-Source: ABdhPJzf9nXi4dVu7ojVyIj811XccT9VSCKZQn8WR4cJzu9zCV469csLZnYFE4al5Izyaigxq4PPUQ== X-Received: by 2002:a1c:4d11:: with SMTP id o17mr8521536wmh.134.1594983284344; Fri, 17 Jul 2020 03:54:44 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54: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 v5 10/13] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Date: Fri, 17 Jul 2020 12:54:03 +0200 Message-Id: <20200717105406.82226-11-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 | 78 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 55 +++------------------------- 2 files changed, 81 insertions(+), 52 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index fc6bf36e42..7369605e4c 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 }; @@ -857,6 +859,72 @@ static int bisect_autostart(struct bisect_terms *terms) return res; } +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) { enum { @@ -870,7 +938,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 +965,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 +1039,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 Fri Jul 17 10:54: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: 11669809 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 C3B90138C for ; Fri, 17 Jul 2020 10:54:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A997920768 for ; Fri, 17 Jul 2020 10:54:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IU8GDJ4b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgGQKyy (ORCPT ); Fri, 17 Jul 2020 06:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbgGQKyr (ORCPT ); Fri, 17 Jul 2020 06:54:47 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01CEBC08C5C0 for ; Fri, 17 Jul 2020 03:54:47 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id o8so14174762wmh.4 for ; Fri, 17 Jul 2020 03:54:46 -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=RSQny+VB5OmGT1rDnmlDzAyNSVY+cVq5h1oUwbpvvfA=; b=IU8GDJ4bwCYeehmgM/Z3JkdExacIH5c611lwoHpW02RjdxE2wMXmgNQW3/7OoZhMp4 4p89Kx5NtpPM/TAY6bbHihQusp42y4zI4/lD4Dr1XKUzRWWo/euFXamjPsnAkaMECBIC /MysWfZgtYA83zqwDbrpdKWBagBoz6Ply6LleVxpJSYIpylUwX/jBLe1K+ssRE5RvXtP 95yPPCRVabqItjSetIoKcQMG3kbVFqmhcpAWksaHZfeUxaWqhFIaR6XpkuwmF7Vtjm7R tIxHxoYuxjYJFfLI7Gev2flfKO3ubl+vgNNM8DcbGOkRWyCsjy6qzCiabThobYFuxNik flCg== 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=RSQny+VB5OmGT1rDnmlDzAyNSVY+cVq5h1oUwbpvvfA=; b=E4pPrvrIEyJid9u8WfyQDr40F56Q0KdlA07kHMdcVOupkuqakLOULv4Y6ZjCdfwZGM DOM30OaQIMWehBkwkoSdZVVGbOQphD5tKz8i8YCvMSHBZbE4vY0MEoA6pO2vEMsfVNdg +uA1l/0mPuFpgyHEe6uO/LIlTdRFYzwTzcmfRYw2frSn4UAgJCGfTpQtZi9z2UR/+qrM Jq6hXaGU2lPmJItc1icTXhsPIKPiFW6DHDYmZSual/hpfBsH/g27a/hN8hpzibm0GoRL E5iBwyEP5UYbQlo5647nc3+ldRFznaSl1YL/Absv9K9Nwdax4G6jNyy8C3lK/nkAoeYG Jadw== X-Gm-Message-State: AOAM530pxU6TkCCI8L2kZ8Nzb4a4NLb9SQn2ka1Mnol5V3TfLAU/q76e jENML3rZUUCdwych9pWTeA1aCFw+ X-Google-Smtp-Source: ABdhPJyUUjQqEMj5Qoh8k6HZoaqjTRKqXF0SQFJR0byyatZ5orf+i6fxzoExXjQL9Tl7edqkj9a0Yw== X-Received: by 2002:a1c:7ed7:: with SMTP id z206mr8406244wmc.135.1594983285526; Fri, 17 Jul 2020 03:54:45 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54:45 -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 v5 11/13] bisect--helper: retire `--check-expected-revs` subcommand Date: Fri, 17 Jul 2020 12:54:04 +0200 Message-Id: <20200717105406.82226-12-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 7369605e4c..370d344bbd 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; } -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; @@ -929,7 +905,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, @@ -945,8 +920,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, @@ -987,9 +960,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 Fri Jul 17 10:54:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11669813 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 CFF2513A4 for ; Fri, 17 Jul 2020 10:54:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B77EF20768 for ; Fri, 17 Jul 2020 10:54:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JSDKhDG8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgGQKy6 (ORCPT ); Fri, 17 Jul 2020 06:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbgGQKys (ORCPT ); Fri, 17 Jul 2020 06:54:48 -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 10A4AC08C5CE for ; Fri, 17 Jul 2020 03:54:48 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id j4so10472381wrp.10 for ; Fri, 17 Jul 2020 03:54: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=DJcYt2mUNpA0cjBUBsvUOSqmydUqTP6lp+S0VQACTDU=; b=JSDKhDG8c0LXdYcX073TLKYXeoi7m1VFcZS7fFsPF6MjhWJJxzgm18JC/5SBmN/OMf Flt0i/UdBKqX9z+sgZO5aQ4WxmGIbzwmoMBHd6SsbLcqPWq2vZvU9axTVjXD9MILNixd lt6e3x/1thR/w6+GQJeGHYnO+lnqH7MCANK0ozA2tkNv5i5/mzponELsKW8oGG0nt0zX /fb0BEG9eRXRA2DBzdK0cNwPPTlpItrbsy7nD8FG6mfIN1U50QiJITXi7RCUvnIEW8G6 AiX9DlWNUmdMfsCAWlcQd3HpIBfI+nePcLzOcYjxVm9u0BYX89RzFgL2/S0lAHqNGFEX ymkg== 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=DJcYt2mUNpA0cjBUBsvUOSqmydUqTP6lp+S0VQACTDU=; b=COhj2OT0Re1UeS8eBAg0o3goZ3LUzZyCnOz3HFq+Kd1PNmsPWbV4yGpo3yTPQoEzfm QpYTncEj2V5FsB4YBYJJ9/bvSfdS2oijZikqntT0JUiwK7Ww/hn1nCnmmQyV2dwxnXx6 IUQvrpMLuYMekurokCk2iTq3vA86KlWA+KbPjvR4VF5JS+bMYdleGkH4Jw1rY4TSOgyJ Y/F1ZgL8eYkKcI42Qsgvp60G7sghFHy+pd46O0xtNPRsFH0XcmIPCG3Q5qNX3PsY/leY ohdwjW3pP0droMslSBfGXRAY4XFBs4Onuflt+z2WTupqobT2jrVB4UP0CJgcF7q9AKrC 7B/w== X-Gm-Message-State: AOAM531zX3eq6Dbh513+RMb4v5PVZTOA8FlW6EyxTBOmFiyDhhi+PkTI yPdga+q1FgljMiRpNKisrzrGKaR4 X-Google-Smtp-Source: ABdhPJxGYCEDDPp4J0UiO9+k38gVCcJpG1R8dbcnTtFC8yXfSPk1gqC3UqvxWFd8755lHwhgtupv9g== X-Received: by 2002:a5d:6cce:: with SMTP id c14mr9196818wrc.377.1594983286635; Fri, 17 Jul 2020 03:54:46 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54: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 v5 12/13] bisect--helper: retire `--write-terms` subcommand Date: Fri, 17 Jul 2020 12:54:05 +0200 Message-Id: <20200717105406.82226-13-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 370d344bbd..6f42e968ad 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 "), @@ -904,8 +903,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, @@ -918,8 +916,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, @@ -956,10 +952,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 Fri Jul 17 10:54:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11669811 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 F0B4613A4 for ; Fri, 17 Jul 2020 10:54:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D66472076A for ; Fri, 17 Jul 2020 10:54:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q+ub72ah" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726675AbgGQKy5 (ORCPT ); Fri, 17 Jul 2020 06:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgGQKyt (ORCPT ); Fri, 17 Jul 2020 06:54:49 -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 24DACC08C5DB for ; Fri, 17 Jul 2020 03:54:49 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id o11so10506297wrv.9 for ; Fri, 17 Jul 2020 03:54: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=Z+Un0S0WKVlK4zYjloNvUAcbWjdMeO2ifKR96edwGHo=; b=q+ub72ahxHuQrQttHjxyMVGwtgHwX/DKiFA1+jZEJhTabbrGp6I84/WhFi+F/ZdP4/ K6LT1gqs/avJi9/NLNrEKogpBwB4sW2erjsTTC0iSOAHe07zkLnX5azN0lRvQW7qHvAO ZhLkxYsxfj+NUSqlUjsL5aOwVRSS+NjrN6G4prThxzpsjRxiR/4jq03ftY/EFMPsWELI pJ67ElpWUzTe/PVtBBzPksw2LmT8yP19y8lOWrG8iB34EpSYTQ4002nIWNQFU8516/jA aTfPVDD5L613LRecRZr7Ep1n2taSpvsXyOvjz9u6w5U6UG31NznrO9Z0JY2+a18NPFnl hFpA== 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=Z+Un0S0WKVlK4zYjloNvUAcbWjdMeO2ifKR96edwGHo=; b=c4uW7/urwoSbGdxG4Fzja6SoDBNvXUe1X8fUArcZ4lcfzR63s+xix21l4ffTF4++wc tr5JSDpc0/Ey0b+nIj8Edh0aNpIcwWfffPVcn1SLQYkpL7Axb6FAX6iZq8eeYOLA9gF8 Xd/RCDwEOme7n8PGUtWaMyoXfaiY0qagiQ/pQsivC4heUiDi8q+tKJVnhiSGDr+puEeg yWSCRtSLEETmp6JjgIJBB6R1gPwqwVpTvvVhSpUIADm6a8/vuSNRpvFsL/bpKS3JBqD4 7aDD8Iul8P+psBPAdEAwpIcO+NmLtveYesSelgecxASNGznXeKPdzm2pS/RbQ0ZJ+S2Q Jv3w== X-Gm-Message-State: AOAM530DXC/ohrOS9q+2Z7NfQSUuEmadaniR6bfpRqwAkmrWQt7y03Kr h6eFFcfMh9hGNxS/ZQzuun1lI5FV X-Google-Smtp-Source: ABdhPJwfSHZL/Tp01dyq3f+inoWTrTmXxq4bG9xugp6AIHbuCl8i3PZSzgD8UVyO5iGVWH5Zg9oxQw== X-Received: by 2002:a5d:4c91:: with SMTP id z17mr9412127wrs.267.1594983287654; Fri, 17 Jul 2020 03:54:47 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.178]) by smtp.gmail.com with ESMTPSA id w14sm13924474wrt.55.2020.07.17.03.54.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jul 2020 03:54: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 v5 13/13] bisect--helper: retire `--bisect-autostart` subcommand Date: Fri, 17 Jul 2020 12:54:06 +0200 Message-Id: <20200717105406.82226-14-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200717105406.82226-1-mirucam@gmail.com> References: <20200717105406.82226-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 6f42e968ad..20d359b2ca 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 @@ -911,7 +910,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; @@ -932,8 +930,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, @@ -995,12 +991,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);