From patchwork Thu Oct 15 13:38:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADB86C43457 for ; Thu, 15 Oct 2020 13:38:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 511BC2222B for ; Thu, 15 Oct 2020 13:38:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OoH3hX6M" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387634AbgJONi6 (ORCPT ); Thu, 15 Oct 2020 09:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387591AbgJONi6 (ORCPT ); Thu, 15 Oct 2020 09:38:58 -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 A2C4CC061755 for ; Thu, 15 Oct 2020 06:38:56 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id t9so3485316wrq.11 for ; Thu, 15 Oct 2020 06:38:56 -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=cFGUeazmN8IA86N71XkqLUHEi7UNYWpGhbDRPTEdlpw=; b=OoH3hX6MyjEC4auChnDxyXoLTXGSFRZzd+EcoHw56sGk+ulrBgB2GlfLd/CsZ3HYhf jE8lQWHE0NbO7n7kau5cuxKI413K2j0oVzPLS8Q/ERZGKTJ0fKJ+gprpuvi+VWGG5fwM cCmxxjDBQvtTtPjOOERegxkrTRrC4uc5vfvbgZCnlsly7UMvIik2ZEVWvAk8sseFvphj G7E6QPRDa+qPS0PQd4GIsMDzUCtVFTd7I95rF2hczUG+iKcOsBiQ8NdGy9Sw5BMZXcz9 3m8hGSZflVM5ugIHJE1iNvnp83A3TW7HfMqsb3q2DXq5ckQkpqEvtKRl2gAw/4e9fC2h 363g== 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=cFGUeazmN8IA86N71XkqLUHEi7UNYWpGhbDRPTEdlpw=; b=M9CsjPD4R+eHUZVgOPv7ef+RIkRGumXzhEj4KrIGnGBr3OidDdWhIqxFbkQ6HW7RLa Gh0vE4zGZ2b5qvculYOje5ub1iUehEfW983857xA0Ro9LVLnTNe+ZXeankvNVrVPnHpN XN6nV+pOP6asj2BPeWRkGcz/VPJSMQDQJKJS2fyvrLJyZMjVA8XpieyovAYtpKU9JxeX YjCDj5mmGnUa0vUjEJ0aR7dLOh5IP6stQBE29z+6mT4g+mwmRwfee5Pf7fHJTUGgoGC5 C6i7o877jYcON6ddBqR0Pq44tKhOJAB95gG/IKreLl/HLtpGk8g5KF4CyFSuMvEQe+MG 9zwg== X-Gm-Message-State: AOAM5308u8Wj49es8OwSVnOkCm1EABUbmgRYNfmyAzfb0N+TiUZQYZ4M 87my8SOBBJ/mW3dVyZSXDTNDpkYeW0Y= X-Google-Smtp-Source: ABdhPJykqdakcBPkyqzCqWnDuxamva261mzqA5PJ8yOtVVb4Vbq+tVxNGt5AhPU8q6psZN1qaRzLZA== X-Received: by 2002:adf:f7d1:: with SMTP id a17mr4458430wrq.396.1602769135012; Thu, 15 Oct 2020 06:38:55 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:38:54 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v11 1/7] bisect--helper: finish porting `bisect_start()` to C Date: Thu, 15 Oct 2020 15:38:32 +0200 Message-Id: <20201015133838.85524-2-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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()`. Note that the `eval` in the changed line of `git-bisect.sh` cannot be dropped: it is necessary because the `rev` and the `tail` variables may contain multiple, quoted arguments that need to be passed to `bisect--helper` (without the quotes, naturally). 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 | 41 ++++++++++++++++++++++++++-------------- git-bisect.sh | 26 ++----------------------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 7512b880f0..8adad68268 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; @@ -609,12 +622,13 @@ 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, const char **argv, int argc) +static enum bisect_error bisect_start(struct bisect_terms *terms, const char **argv, int argc) { int no_checkout = 0; int first_parent_only = 0; 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; @@ -753,14 +767,7 @@ static int bisect_start(struct bisect_terms *terms, const char **argv, int argc) * 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 @@ -777,7 +784,7 @@ static int bisect_start(struct bisect_terms *terms, const char **argv, int argc) } if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0, UPDATE_REFS_MSG_ON_ERR)) { - res = -1; + res = BISECT_FAILED; goto finish; } } @@ -789,25 +796,31 @@ static int bisect_start(struct bisect_terms *terms, const char **argv, int argc) 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); + if (!is_bisect_success(res)) + bisect_clean_state(); return res; } diff --git a/git-bisect.sh b/git-bisect.sh index ea7e684ebb..dda386bc3a 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 Thu Oct 15 13:38:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A528BC433E7 for ; Thu, 15 Oct 2020 13:39:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49CB02222B for ; Thu, 15 Oct 2020 13:39:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fjF8MP4G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387592AbgJONi6 (ORCPT ); Thu, 15 Oct 2020 09:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387571AbgJONi5 (ORCPT ); Thu, 15 Oct 2020 09:38:57 -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 91D04C0613D2 for ; Thu, 15 Oct 2020 06:38:57 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id g12so3499921wrp.10 for ; Thu, 15 Oct 2020 06:38:57 -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=4Ow+AP6QkVF3SaDeNeaXjVuBTnDhi9wPFPl7+V6ytus=; b=fjF8MP4GZ4J03lG+guLmt1q4KI3ZlZYj0fio6irTQ4oBhPBqV0pLEwnUJtVRh6C8vv VqhjP3gSiryk9dYCvJyzAT7Pq7j7Blrd2uEfiCMxSgwLIl4dcjAnGJf5Lr+5A8+f2MEP 3NM16Pod9nxefkAj05HIDXcOrzRo/QoxV7MbivXSh/62iUrT8/J9X8tD8O1KBZDuCfaX Xmen3SgWNhXi+mlW9XBjkho0y4J5iRM7UcUCAMnA2Dm8B1toZ6SiMWI3r8lmao66ktuv 3dndAH729cgBZU9WBP8ws33ZSe7sKt9qILDbKceTV4hssBFBBE5c2rVbAqjsl1fSo9AG /46Q== 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=4Ow+AP6QkVF3SaDeNeaXjVuBTnDhi9wPFPl7+V6ytus=; b=DEKQ9rOLc6HTdIYf/zBIA6Kdnvo+Fnk9lfCDuqjnHl+PzurqMcyqtTz2M6Pm+eJFgi R1vsQwtGt6cB49j3mNQRIkFUL+mLxRwtSblwb74SewGif1LFkgmN+HGu9M3ntcmO+Mmo iDCKImkN/ADyuO312RYn8oysQHd9JB3cnA6rwjFyvVMu0TbrPzi4mBqZeeP20s18ypHJ D5WCNJtXjRMJKv5T4pV1P8G7ZniX7jGbkwZBBiq88QuIZvNHqI/od8O5onZQN1q/83KE 8CZfAtvBtwsj6OOK6zdsZxlwALCnhQrPdkKzdk9LowtZi4KkqS7nHqAQlb7WWjIogv5r Pgpg== X-Gm-Message-State: AOAM5304L62vUGH1qkb66IoPXGfqRjiN4VhHObJk5RFMC0jsnLuYFuKn Dl5uZ5U6TWLPUNqVbEjrJGAy5nGmkoY= X-Google-Smtp-Source: ABdhPJxUqp0NNV1LVxmFWf3m71J4EBMcazu2ai84Q8j07DNMfJT9YmCSC4gFd0zHuAjxNbinGHsmmw== X-Received: by 2002:a5d:4141:: with SMTP id c1mr4365294wrq.113.1602769136108; Thu, 15 Oct 2020 06:38:56 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:38:55 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v11 2/7] bisect--helper: retire `--bisect-clean-state` subcommand Date: Thu, 15 Oct 2020 15:38:33 +0200 Message-Id: <20201015133838.85524-3-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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 8adad68268..fbb9046737 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -22,7 +22,6 @@ static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --next-all"), 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 "), @@ -861,7 +860,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, @@ -879,8 +877,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, @@ -922,10 +918,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 Thu Oct 15 13:38:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72759C43467 for ; Thu, 15 Oct 2020 13:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 229452222B for ; Thu, 15 Oct 2020 13:39:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qWJk9nWb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387703AbgJONjA (ORCPT ); Thu, 15 Oct 2020 09:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387591AbgJONi6 (ORCPT ); Thu, 15 Oct 2020 09:38:58 -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 A422BC061755 for ; Thu, 15 Oct 2020 06:38:58 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id e23so3226532wme.2 for ; Thu, 15 Oct 2020 06:38:58 -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=2odWCcl+peeWRLiAEIKMZhirbEEEvODwaGttKMWIFr4=; b=qWJk9nWbKnm3818QX0gr4fTaTcy3U5uXY2Bk5JQ6JFKLlzBYjlxP9syUZJW3+ZXuAO M5tjiVYi0k/bBNP0eFPuHxgJj6ZOZT3JO4ttk0przcO2o70DYKXuBMsCKbCwPC9+PCc3 H50kPl0pJbKF8AUr9TNSDx8FHBUKNw8Kz2R2MlHeBZbCxhUkgbf9sEhYSwAmJauBo453 vkL56GAiqG6W+p4ljkPWl1b0DN1nEngItclRHlFFEA+9uTz3O3ptS+SnN9DqeCVSkXTe /C0wzsGmPZyt31hJWIAsDN55fMxFMFx7+VA84KKXUxXahkUyjb/hONFKIAhigu3b57E6 GEPg== 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=2odWCcl+peeWRLiAEIKMZhirbEEEvODwaGttKMWIFr4=; b=ZLkwCbbX/tX/kH42sPAt7EN3y1A+3aQVcd6Io6ORRAnhuEYv4CwrabCHoYCOMwatHJ Kt4rW8FheOPYWntnZqL9HfE/S8GiVWPZOLjALiJroo6MWHyZTkquPOdzB8Wf1FUbhxN2 PhguSo+Y7dBiXDJNs0fYAl2G643syo0WsxtGIJXtif/OiIrP2UDycaamVtgCEtUIavET 9zt9pgezqIb01Do5ZX5cAJ/SpWI/YgiGwIu1TgI9wlfDn87Ccwi7NOqNdXYoYj4fSIjW b0O05JI8hzVnynoZKngd+1amGd1LbH+RbNUjd4iuVIGrQ7eZLOX43Zr4ralQyQNy2vYo pT+w== X-Gm-Message-State: AOAM530qm5D+KVeHSdahkbjg+T0Zlzs7dgqzzJpkBU1uoW0vQulHd416 rtSYwkG/Y2AsfDPrqjc9AtyOtpnGRBU= X-Google-Smtp-Source: ABdhPJwTmtQsmCj8aisquNAjnGxi3Qoq94Mg24T1iorR7AXnEsNrQO+lAvkM+AX8fLXShukCPbJcpA== X-Received: by 2002:a1c:7514:: with SMTP id o20mr4024976wmc.76.1602769137202; Thu, 15 Oct 2020 06:38:57 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:38:56 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v11 3/7] bisect--helper: retire `--next-all` subcommand Date: Thu, 15 Oct 2020 15:38:34 +0200 Message-Id: <20201015133838.85524-4-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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 fbb9046737..f1a7cfbfaf 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --next-all"), N_("git bisect--helper --write-terms "), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), @@ -858,8 +857,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, @@ -873,8 +871,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int 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, @@ -911,9 +907,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); - break; case WRITE_TERMS: if (argc != 2) return error(_("--write-terms requires two arguments")); From patchwork Thu Oct 15 13:38:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA00C433DF for ; Thu, 15 Oct 2020 13:39:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0873206FB for ; Thu, 15 Oct 2020 13:39:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rDBV3AeO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387763AbgJONjF (ORCPT ); Thu, 15 Oct 2020 09:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387591AbgJONjA (ORCPT ); Thu, 15 Oct 2020 09:39:00 -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 532F2C061755 for ; Thu, 15 Oct 2020 06:39:00 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id e18so3512222wrw.9 for ; Thu, 15 Oct 2020 06:39:00 -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=K3AtYGlCasH5MSn6FwEJCeUrOG3lwBJmagvn3B13CRc=; b=rDBV3AeOfFQPceUNmFqjr23fy3FIHyuon9kleZtGt8h5pE3f8x8pFMW5RycnByGPiv n01dbVklbwx+XDD8VR0K9e+t6Hfa56qd8jA0YnQEWZVrWsW0dWelLcoOgEgXlzIwXPIm sf9knsY8PG3zceBTt054qAu2QYlmPd+Uj6HfY1TWQnLfXN3YJSVap1X514nDUVyTsGsI y4aqvgZ2baRJx2MS04NYhCdpB5fXh+ljQ8Cux7lD/pwjSlICuVfM9sNuwHICBViyNRv1 OmpQZct0GbPnC+8lWYFjO+8FiA4xZ+AI4DEOm0NlhiwV4h5CGgN0ZaH/CaJn11CnZ/8y nbLw== 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=K3AtYGlCasH5MSn6FwEJCeUrOG3lwBJmagvn3B13CRc=; b=t+7qPWuCkZhQNqFUG7AlpnCahotwWh9y0UAy03+9IjP473WH7BOrPdUh4ZvrWy9C2F XSs4v60Ht6d2FEEBEcOR/9hlk2+23ZupZZ+mW2w/CCBgqKtyWJ38VMM//GwRUhuaX3GP a+xhEcgQEsju+mF0hZ7yt+4kjA1aaD/1gInOAUPh80ZdUPAX1NrQlR+I8r0gnGfLoKNk H7LvnLLBAiyAzlJQ1F6YTXRbvXVwNthMXJQ5eXidKSCkBup1qzw1y3+QHsboWF0e+DJq gAwcrOj+td8+D+6Bq2Nn+HwcypJVdLPbOBUtGv0OSpRLqlji2CF7jNxyPIgTqpW6dv3e vgSA== X-Gm-Message-State: AOAM533+lg2+nmHbJ0tGdqDnFBnyz4DETClRPykHh1De0GetNirGatk5 B30zzhz9P8OEc2oIpB4nECYIfP0Es90= X-Google-Smtp-Source: ABdhPJwTKVFiTKESN+tsLpwW09VlhfYXA+u9mziu1nNE+n2dlLnzriY2/0Y5HYNRjGOVq4iKETUdng== X-Received: by 2002:adf:de89:: with SMTP id w9mr4422343wrl.212.1602769138331; Thu, 15 Oct 2020 06:38:58 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:38:57 -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 v11 4/7] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Date: Thu, 15 Oct 2020 15:38:35 +0200 Message-Id: <20201015133838.85524-5-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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. Note that the `eval` in the changed line of `git-bisect.sh` cannot be dropped: it is necessary because the `rev` and the `tail` variables may contain multiple, quoted arguments that need to be passed to `bisect--helper` (without the quotes, naturally). 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 | 86 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 55 ++----------------------- 2 files changed, 89 insertions(+), 52 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index f1a7cfbfaf..42b8352546 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 }; @@ -854,6 +856,80 @@ 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")); + + if (bisect_autostart(terms)) + return BISECT_FAILED; + + 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) { + const char *head = "BISECT_HEAD"; + enum get_oid_result res_head = get_oid(head, &oid); + + if (res_head == MISSING_OBJECT) { + head = "HEAD"; + res_head = get_oid(head, &oid); + } + + if (res_head) + error(_("Bad rev input: %s"), head); + 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); + oid_array_clear(&revs); + 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)) { + oid_array_clear(&revs); + 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 { @@ -867,7 +943,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_AUTOSTART, BISECT_NEXT, - BISECT_AUTO_NEXT + BISECT_AUTO_NEXT, + BISECT_STATE } cmdmode = 0; int res = 0, nolog = 0; struct option options[] = { @@ -893,6 +970,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-log", &nolog, N_("no log for BISECT_WRITE")), OPT_END() @@ -963,6 +1042,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", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index dda386bc3a..1f3f6e9fc5 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 git rev-parse --verify -q BISECT_HEAD > /dev/null - 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 || exit - 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 +'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 Thu Oct 15 13:38:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C1A5C433DF for ; Thu, 15 Oct 2020 13:39:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CE93206FB for ; Thu, 15 Oct 2020 13:39:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IzEP93sN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387804AbgJONjF (ORCPT ); Thu, 15 Oct 2020 09:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387712AbgJONjB (ORCPT ); Thu, 15 Oct 2020 09:39:01 -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 F1987C0613D2 for ; Thu, 15 Oct 2020 06:39:00 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id h7so3545220wre.4 for ; Thu, 15 Oct 2020 06:39:00 -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=u47w77awamzb+L7raiUDc6pj21MyRrnxWiR2sNQL5LI=; b=IzEP93sNVIGT5kPcrxVtQ+hUtrnZ86SjkcOkjUQP35CclqeVaKLX9OQS1QMn8FpJPj 5/uZTJvp6Q7GDsc1IzPhQ7vZCyg7127hg7IxU/nnRgFKt1p528oqJxMsrKbv1vGF/c5c Zvx0Prig/xI7byHaPU8lOdLV5KQMgbUg53+EPIM7aamBjYNcNQ3udkUCTKYnYM3B/IiP 0PV+4MzBubhuaLoYeInAyFJkyasBA32x4K8oTy2F/FgOA7E7be4/ZWxA1Cx2AiJJDuMr pQ84A2APmslDpcd5rZJ10UPBX17/ieQEP7Q3m8zb0PJcH7Lhcc4wiu6MRLAJJ3FZCpbR OVUg== 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=u47w77awamzb+L7raiUDc6pj21MyRrnxWiR2sNQL5LI=; b=Qs1ITpiv6KKebgpoDywuDoZnYmps8TmoN3xRSBehegfP9HjsqmmCFPrYP9yfBTQZk1 dlR/aNrh1vuDgHvsMJH3dFPoeiEj01tC3pYmLoGbG6SMZ1+UTixC1qL9iUv9Ah9mVnlV A53YP+GRbBmpKrscfbtotRw38dZ0WOj9zNMQGSxzngwIUgrDBnPZTOAEfsQh0jEo1YiI /seRdheyVr8TLXUoP1+6phtKQkjFqZXQbbOvO7NK52wLPtgnCUVreXbQYcFVDkZfssl/ uLehq5XGyWWKpTzKcFLnPNykDylYL7wB34z63OLt9NM5fEqS5iMaIedeK5eMBVkb/06G D0yQ== X-Gm-Message-State: AOAM533MH40C5OS6Ow69cxuC+T6MFOdC2RWL88advFRRU87V8h+Gsuty 99uBVYDsZPCjibCuM3B+ca/1h1Zf0/A= X-Google-Smtp-Source: ABdhPJyztqvHjwFB0LXAjVwgm/kHU+jm2BWKVEqdklRWhE90Sa8oS4kM2+MP0xb4bgFt1f5877G8/g== X-Received: by 2002:a5d:60c4:: with SMTP id x4mr4370623wrt.75.1602769139531; Thu, 15 Oct 2020 06:38:59 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:38:59 -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 v11 5/7] bisect--helper: retire `--check-expected-revs` subcommand Date: Thu, 15 Oct 2020 15:38:36 +0200 Message-Id: <20201015133838.85524-6-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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 42b8352546..64a5752ce0 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -187,30 +187,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; @@ -934,7 +910,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, @@ -950,8 +925,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, @@ -990,9 +963,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 Thu Oct 15 13:38:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 365E3C433DF for ; Thu, 15 Oct 2020 13:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFB21206FB for ; Thu, 15 Oct 2020 13:39:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tgLv6BZv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387819AbgJONjF (ORCPT ); Thu, 15 Oct 2020 09:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387724AbgJONjC (ORCPT ); Thu, 15 Oct 2020 09:39:02 -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 160C7C0613D3 for ; Thu, 15 Oct 2020 06:39:02 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id n6so3482873wrm.13 for ; Thu, 15 Oct 2020 06:39:02 -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=BuE95BCqomNquhxZDflK3d51oTwTRc/eh+AAKZaOgTA=; b=tgLv6BZvwGpV5uYSOj1/O25cT52W7KWuhPSeosOkXjgwMu532UJfY/10+H4HPMoh1I Y5XxRVjb51NHPsL0vYhFlDd1Ttt/WhyQsQIngtPn54eY00k8uoIVRXKav1/DIfLXX1wh XWiP6D4gMJ5gwRTsIy7f3dx884tLDmq/d4BLcEJ5NdZBmLFlmfwXk8pWlT5QK9Bypn7k x5sI52yU0fxLsrAUHtu+Wla1cVn/jsxm2l6otnwm0l0E9hYJTZTuYB21Dgta4E4tYMmE OOlC9Ve7+xt6zdVymh75hW74Evj4XMAlIfKZVxgCWjeOrWzrIQMtMh+WDjKq6azYUqxm PT6Q== 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=BuE95BCqomNquhxZDflK3d51oTwTRc/eh+AAKZaOgTA=; b=bjPQ6DVGfXOSNZdravJgOrW8KTSJkX/2ndIHGHSvNJ2mKF96dcte/XZxx70eGgIvps HSG+D6ZUUb0HH7R/1ky6uu8451BemGxUn/X6Fu2MxGbW6mlHlf5SY9QJx/IVPwM4Q4+j bXfP5BvsZVzWDgiEulBX3F47Q0Kn3ABTX4FVmw7xVls4BdOecOSjO5lqeH4toGXE0OQq uoSpEo9s3bzyHgulFl1IuwZiUSVHfmT356OFoRgd7nxSmCya3pBrQ9+6Zh6hgmflSoev 66MR76vBF9XvVi+2C4N2ZdqY6u91vpbzfW75gb/3LZPnQEHwtYEeQV855ORLlSyffbI7 c7ug== X-Gm-Message-State: AOAM533OTz5V/WQpMjBAmWbGxHljE3aL2nV0LJZIzedl3l1QBmnPVwKK MI55E8KzyfWaDz9brIoQioAYp3EY4PE= X-Google-Smtp-Source: ABdhPJxuy836c9Vtp/fkc3aWyxen0WozvjpEDE/X9QzVJdxa3X51oesoVf3qaX/gC75wGRg54b91Tg== X-Received: by 2002:adf:e744:: with SMTP id c4mr4420755wrn.222.1602769140642; Thu, 15 Oct 2020 06:39:00 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.38.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:39:00 -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 v11 6/7] bisect--helper: retire `--write-terms` subcommand Date: Thu, 15 Oct 2020 15:38:37 +0200 Message-Id: <20201015133838.85524-7-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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 64a5752ce0..9a7e67a87a 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT") 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 "), @@ -909,8 +908,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, @@ -923,8 +921,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int 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, @@ -959,10 +955,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 Thu Oct 15 13:38:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11839351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E122BC433E7 for ; Thu, 15 Oct 2020 13:39:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 882802222B for ; Thu, 15 Oct 2020 13:39:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iADkt44P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387851AbgJONjG (ORCPT ); Thu, 15 Oct 2020 09:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387734AbgJONjD (ORCPT ); Thu, 15 Oct 2020 09:39:03 -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 5BA54C0613D4 for ; Thu, 15 Oct 2020 06:39:03 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id n18so3539306wrs.5 for ; Thu, 15 Oct 2020 06:39:03 -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=7Y9zws2CNUY57fKoHnYF+f9ypkjcwCKCuwoRSnZPJdU=; b=iADkt44PI4rEzoOqdvWQCJnnzhr41BS3l7ibHDzrUNzYhg/hheOCigLeCP4E69gAKZ /EdZDk31ewuqqvPHKxFwsd4flik7SBlqHdQxVZ6wgVWL1sAzHNKCTlQuuxmMIIAaS7wT bHdReCZT/mEswKTOWkEhUtIePJdXByBbMdLKHWlQExkMzVHvDdRhsPNBhyD/3rka4PH0 /sb6M2IXE98iABw8uTOlAC+xiaHUL35aoG/JxEle6vE60QpPsIsS3UkVaPQw1WH0Tq/Q wzmot+qxumCifbCKJduaOASboBMED2VD+tUVrTgu9d6y8wt/UcRHgr/8owjceCI54fPW b1kA== 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=7Y9zws2CNUY57fKoHnYF+f9ypkjcwCKCuwoRSnZPJdU=; b=GN955NojOwnnJrosnDbs6C/JpjMSGYGX7S5cKPg9f1Z9g+VqcHjyW7FD1m6Ycqb1ch akVcml65FvKDYWNzw/C4WDXgmmyagob/N0T2963pHACPuSnUUVNuXmKDD8Zk2sY5SS7I 08PFR/Eu8XqNHN1rTBQbnYWr6Pu3Fk6j6B87zVCux1w5qYkPvy8PL0wXr/zf0l1STNGS Yry2AplwBSOiyW0/Pzby8afGwhoaoIDEjfbsQBIHlTx9P6z1JVn/6GsprL7gQ6dzV6YS 1PVDXcw3Lh2lfEvbKwLgsabDZQjl2bUz4V3mTpIFylVs2fp9bx9BCCuiu6Pql9iuoofF e2uA== X-Gm-Message-State: AOAM5322JEB1COVI4+zdP9EI/5LhP+qHeC9Gp1M1s41AeIIp6+YYOvLU ceeZz45jZYW5ycPXTX/5M7MsPgzb2Qw= X-Google-Smtp-Source: ABdhPJyU/st6PYapaHRDgadSDHGVUs0M4VgNqeYQUXhiIMKGvMBT2O2HnC1pDvKgbbkkvHr479baVQ== X-Received: by 2002:adf:f0c2:: with SMTP id x2mr4383881wro.63.1602769141875; Thu, 15 Oct 2020 06:39:01 -0700 (PDT) Received: from localhost.localdomain ([91.242.153.231]) by smtp.gmail.com with ESMTPSA id o4sm4709434wrv.8.2020.10.15.06.39.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 06:39:01 -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 v11 7/7] bisect--helper: retire `--bisect-autostart` subcommand Date: Thu, 15 Oct 2020 15:38:38 +0200 Message-Id: <20201015133838.85524-8-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20201015133838.85524-1-mirucam@gmail.com> References: <20201015133838.85524-1-mirucam@gmail.com> MIME-Version: 1.0 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 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 9a7e67a87a..709eb713a3 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] [--first-parent] [ [...]] [--] [...]"), 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 @@ -937,8 +936,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-log", &nolog, @@ -998,12 +995,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);