From patchwork Mon Jan 25 19:17:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045267 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 16DD8C433E0 for ; Tue, 26 Jan 2021 05:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D038922B51 for ; Tue, 26 Jan 2021 05:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729163AbhAZFBM (ORCPT ); Tue, 26 Jan 2021 00:01:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730713AbhAYTSL (ORCPT ); Mon, 25 Jan 2021 14:18:11 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E2EC061786 for ; Mon, 25 Jan 2021 11:17:26 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id p15so7472930wrq.8 for ; Mon, 25 Jan 2021 11:17:26 -0800 (PST) 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=etuzwx57DGg4ATPYEKGldv9+oa/V6x4dfr2h/axrjQU=; b=PfmRTGLQ2JPcLgDuSM5b0qcNFc8YbKng3rBw36Y74lzA/FFUOLOZWCV2xxKiKwdzDc NjHMeHlZBA7en498BJaTsk8OIcFC/kQ0TklCCCWut6cNULdcQp3trgz6yLfmsJP28OfO TTqqSFnOAl9FpCjzh6WEk+WG2OYO6YkHNGAtiIUoxZM57ZmlCGpckHp0PFOHsnMCh8Ws TbArmvjbfb2pSjmBZoMCIZ3vRVYtvHRCYNaAcZPVZPxZA0zQFdMAyyZE64snX/imsEAO J6t3/OBWQq3LVLalFYfvPUmGGccHK5nnTNKvH/cLsTBYSB+HOxlvTNMheT6hCx5QHekG iBPQ== 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=etuzwx57DGg4ATPYEKGldv9+oa/V6x4dfr2h/axrjQU=; b=cKol5C1Jf+xU/PwGfIbjRG+9T1aathcShY87rRDPAavA8glv+Q/xrF01g5eblUShfQ Ws4MblvmrzdePCusXQZqVvhe/Z0bqaJxNip6NGOnAe47IY0JJTDXXaVw6ENqV2eU8Egb wmK1eX0mPoQZBAiAN62zPMMRShvtLkaDiJG94N54Tu4UDdBn3NhcntFvWEp1GriyFJc3 QvPG21iCNUNcrbUl6pXFeuaUsthpLOroOgivtSkxD9CeNaeKcRvsghree8fqo4BmNYxI XGSEvWcPgbfTDYVCxjeMHeHuTMKRzBnuqyHpKavywQeqBG14ZmGE0zJUtYzv7b5L5d30 Orkg== X-Gm-Message-State: AOAM531k6ko8Dxc0MF8dX/3KzLcSS2VTaxcHr8Y5DUFLmvCQlrCnRizQ WHHAa9R51UUZLJE1pKHRO+Yi2fTXGPM= X-Google-Smtp-Source: ABdhPJxqfVaoqV+YCgVDwV4jZ5fHMw1R+x6RW20704PlEAxascwvsWCL6TBER9JhE/rsgzA3ev6wBA== X-Received: by 2002:adf:b74d:: with SMTP id n13mr2697157wre.62.1611602245421; Mon, 25 Jan 2021 11:17:25 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:24 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 1/7] bisect--helper: reimplement `bisect_log` shell function in C Date: Mon, 25 Jan 2021 20:17:04 +0100 Message-Id: <20210125191710.45161-2-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-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_log()` shell function in C and also add `--bisect-log` subcommand to `git bisect--helper` to call it from git-bisect.sh . Using `--bisect-log` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. 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 | 22 +++++++++++++++++++++- git-bisect.sh | 7 +------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 709eb713a3..a65244a0f5 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -904,6 +904,18 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a return bisect_auto_next(terms, NULL); } +static enum bisect_error bisect_log(void) +{ + int fd, status; + fd = open(git_path_bisect_log(), O_RDONLY); + if (fd < 0) + return BISECT_FAILED; + + status = copy_fd(fd, STDOUT_FILENO); + close(fd); + return status ? BISECT_FAILED : BISECT_OK; +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -916,7 +928,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_AUTOSTART, BISECT_NEXT, BISECT_AUTO_NEXT, - BISECT_STATE + BISECT_STATE, + BISECT_LOG } cmdmode = 0; int res = 0, nolog = 0; struct option options[] = { @@ -938,6 +951,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-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), + OPT_CMDMODE(0, "bisect-log", &cmdmode, + N_("list the bisection steps so far"), BISECT_LOG), OPT_BOOL(0, "no-log", &nolog, N_("no log for BISECT_WRITE")), OPT_END() @@ -1000,6 +1015,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_state(&terms, argv, argc); break; + case BISECT_LOG: + if (argc) + return error(_("--bisect-log requires 0 arguments")); + res = bisect_log(); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 1f3f6e9fc5..05863cc142 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -169,11 +169,6 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 done } -bisect_log () { - test -s "$GIT_DIR/BISECT_LOG" || die "$(gettext "We are not bisecting.")" - cat "$GIT_DIR/BISECT_LOG" -} - get_terms () { if test -s "$GIT_DIR/BISECT_TERMS" then @@ -210,7 +205,7 @@ case "$#" in replay) bisect_replay "$@" ;; log) - bisect_log ;; + git bisect--helper --bisect-log || exit ;; run) bisect_run "$@" ;; terms) From patchwork Mon Jan 25 19:17:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12048351 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 5D79EC43381 for ; Tue, 26 Jan 2021 20:51:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36BBB221FC for ; Tue, 26 Jan 2021 20:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbhAZFBh (ORCPT ); Tue, 26 Jan 2021 00:01:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731593AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841EFC061788 for ; Mon, 25 Jan 2021 11:17:27 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id j18so414591wmi.3 for ; Mon, 25 Jan 2021 11:17:27 -0800 (PST) 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=BAu+lyOkuwI3+lcw2UF8LucEAJAOCPo622DGOT+cEbE=; b=qFf2QVITFbOMZuYLGFrdAaelw7UPyCQgcVtXh6DdgkJPuLQ58BoJtjXykW+o34Mp/P c1HiP4cUACY/dw67Q5facZIV9CXcy0dG239QToCuzFxLWhGtjtu6L1COdYibd0pGBp16 NE12xKh3CwnVmvv7zQ5SEdw6EHBJx+v4F0lIBiYIopT/EDkfLVWoQa9aUN+Eq8zMJO05 G0oicBCyYSt7X5hcbCVlZktfOBiIKLo1t2JyK33zJD+H9AB1oq2iwT4G2Ov1Jx2FtjfP FduP3rZ2lL3yQ1Dp9D3606Cqr8qIq+XRb5webls6PRxdDpLTqCrhe2oAfUED/X8fBvKt NDpg== 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=BAu+lyOkuwI3+lcw2UF8LucEAJAOCPo622DGOT+cEbE=; b=DoFyB8pdKjsopwpkoejycJxL2Rv0mhV793UlwWBq+E5sZ7IARl/1p1ZqYaU9H/aDFe mDZ/4QLolg2PhlyuiFzLExvy/XwojyB+XK2Ri81eXJRqDUK40t6LxwYrUXzHDaTWNW08 Ard1+DV677fmKuE5mKHVY/r7cMJtU/watp/Sd2D0myConw7i7mGDRoqADoaqWYJVK6Sp 0QwK/5BPlNYZYJ60gTLAST7E38QDv7sDHOrcWf5QY/w5giXf/qHiDMfxJ4Y32MQPUQfN K62xOY91wHYxFFBycHV9PlBSY5I5Pf8yT4wu0mtzUmULSqeS+IrPHmQ5THXubCSV7Ypb LWiQ== X-Gm-Message-State: AOAM530vOYb060qkr4yI+2bYawgpAcI8gQ2tF7HJA7yYSv6cGr2BmUJM 8theJls5E2F+8TG23pTSdl2/QXAU2qw= X-Google-Smtp-Source: ABdhPJyt9PzROqvgUUyxlwjLoa1Cb003Wtqk61LaiSmBXN84jP4t1POdnjCxwvzfzrXCJWk6qN3ohA== X-Received: by 2002:a1c:6308:: with SMTP id x8mr1438371wmb.108.1611602246349; Mon, 25 Jan 2021 11:17:26 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:25 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 2/7] bisect--helper: reimplement `bisect_replay` shell function in C Date: Mon, 25 Jan 2021 20:17:05 +0100 Message-Id: <20210125191710.45161-3-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-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_replay` shell function in C and also add `--bisect-replay` subcommand to `git bisect--helper` to call it from git-bisect.sh Using `--bisect-replay` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. 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 | 85 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 34 +--------------- 2 files changed, 85 insertions(+), 34 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index a65244a0f5..d65b2f44c6 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -31,6 +31,7 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-auto-next"), N_("git bisect--helper --bisect-state (bad|new) []"), N_("git bisect--helper --bisect-state (good|old) [...]"), + N_("git bisect--helper --bisect-replay "), NULL }; @@ -916,6 +917,79 @@ static enum bisect_error bisect_log(void) return status ? BISECT_FAILED : BISECT_OK; } +static int process_replay_line(struct bisect_terms *terms, struct strbuf *line) +{ + const char *p = line->buf + strspn(line->buf, " \t"); + char *word_end, *rev; + + if ((!skip_prefix(p, "git bisect", &p) && + !skip_prefix(p, "git-bisect", &p)) || !isspace(*p)) + return 0; + p += strspn(p, " \t"); + + word_end = (char *)p + strcspn(p, " \t"); + rev = word_end + strspn(word_end, " \t"); + *word_end = '\0'; /* NUL-terminate the word */ + + get_terms(terms); + if (check_and_set_terms(terms, p)) + return -1; + + if (!strcmp(p, "start")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(rev, &argv); + res = bisect_start(terms, argv.v, argv.nr); + strvec_clear(&argv); + return res; + } + + if (one_of(p, terms->term_good, + terms->term_bad, "skip", NULL)) + return bisect_write(p, rev, terms, 0); + + if (!strcmp(p, "terms")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(rev, &argv); + res = bisect_terms(terms, argv.nr == 1 ? argv.v[0] : NULL); + strvec_clear(&argv); + return res; + } + error(_("'%s'?? what are you talking about?"), p); + + return -1; +} + +static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *filename) +{ + FILE *fp = NULL; + enum bisect_error res = BISECT_OK; + struct strbuf line = STRBUF_INIT; + + if (is_empty_or_missing_file(filename)) + return error(_("cannot read file '%s' for replaying"), filename); + + if (bisect_reset(NULL)) + return BISECT_FAILED; + + fp = fopen(filename, "r"); + if (!fp) + return BISECT_FAILED; + + while ((strbuf_getline(&line, fp) != EOF) && !res){ + res = process_replay_line(terms, &line); + } + + strbuf_release(&line); + fclose(fp); + + if (res) + return BISECT_FAILED; + + return bisect_auto_next(terms, NULL); +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -929,7 +1003,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_NEXT, BISECT_AUTO_NEXT, BISECT_STATE, - BISECT_LOG + BISECT_LOG, + BISECT_REPLAY } cmdmode = 0; int res = 0, nolog = 0; struct option options[] = { @@ -953,6 +1028,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_CMDMODE(0, "bisect-log", &cmdmode, N_("list the bisection steps so far"), BISECT_LOG), + OPT_CMDMODE(0, "bisect-replay", &cmdmode, + N_("replay the bisection process from the given file"), BISECT_REPLAY), OPT_BOOL(0, "no-log", &nolog, N_("no log for BISECT_WRITE")), OPT_END() @@ -1020,6 +1097,12 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) return error(_("--bisect-log requires 0 arguments")); res = bisect_log(); break; + case BISECT_REPLAY: + if (argc != 1) + return error(_("no logfile given")); + set_terms(&terms, "bad", "good"); + res = bisect_replay(&terms, argv[0]); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 05863cc142..e834154e29 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -77,38 +77,6 @@ bisect_visualize() { eval '"$@"' --bisect -- $(cat "$GIT_DIR/BISECT_NAMES") } -bisect_replay () { - file="$1" - test "$#" -eq 1 || die "$(gettext "No logfile given")" - test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")" - git bisect--helper --bisect-reset || exit - oIFS="$IFS" IFS="$IFS$(printf '\015')" - while read git bisect command rev tail - do - test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue - if test "$git" = "git-bisect" - then - rev="$command" - command="$bisect" - fi - get_terms - git bisect--helper --check-and-set-terms "$command" "$TERM_GOOD" "$TERM_BAD" || exit - get_terms - case "$command" in - start) - 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) - git bisect--helper --bisect-terms $rev || exit;; - *) - die "$(gettext "?? what are you talking about?")" ;; - esac - done <"$file" - IFS="$oIFS" - git bisect--helper --bisect-auto-next || exit -} - bisect_run () { git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit @@ -203,7 +171,7 @@ case "$#" in reset) git bisect--helper --bisect-reset "$@" ;; replay) - bisect_replay "$@" ;; + git bisect--helper --bisect-replay "$@" || exit;; log) git bisect--helper --bisect-log || exit ;; run) From patchwork Mon Jan 25 19:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045277 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 AD59EC433E0 for ; Tue, 26 Jan 2021 05:03:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8288022573 for ; Tue, 26 Jan 2021 05:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbhAZFDQ (ORCPT ); Tue, 26 Jan 2021 00:03:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731638AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B7EFC06178A for ; Mon, 25 Jan 2021 11:17:28 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id f16so397454wmq.5 for ; Mon, 25 Jan 2021 11:17:28 -0800 (PST) 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=rboGbPio/8esdvVcKT7zrjr6ldwqgY+uOQD8iI9ui0E=; b=jXMgmP4225HafldqH5kHUl3YmozKxedqV2NrGfrFxECC81VtHLzTKfCpPaf0vcOuNb +gWfa4in+ivPJQG68EzlOK719x8luE4RQSAsLsDhQNMPafSnJUdo4rmiFieDYqLVEDCR qlyasOQbFNblxu9qMq3bs3Yk/ZD0oV2DJNjigkkYRtzEVYYNv9tJxdGNOX38xhVuH6x8 LZS9dXKIOhdEtMu5jus7U30KragZEgE/xxSD5te3l2Kjwj2v15nBpH+6mJgJaZJ9dsMS n6zVRhOrFcsLiHX0422D2xa4y+OzOBCRh5abY8yk0MD7nIatHFYprqtJOdJ1mIID8SpQ PvGw== 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=rboGbPio/8esdvVcKT7zrjr6ldwqgY+uOQD8iI9ui0E=; b=uXBlNP+b9sZtMC5TZ53O3tuDKLMPQsmYhskNimq5tViJvt/qeCT4hEAQ6tKlkX0OGD 3A798Cm0m9Y+9rAWusVTz0pxstnGJH5TxjwDdLo8m9TUNO6N6eAKVMZ+26k2jorvNn3D Lq3LX5TV88C2Z63UuvPgpE+QD6cf+tZCn00onT2XSNMo2U8YWHXfVq/U4/+n7ebNdqij mlArx38QAkjC8gpXic5FwjEK7Q0IDxMyFvGAn8BXctLudpTu0WecbY33zX64hZg8/DqI VtSnelXOOEvmn7oEdGKdidBb/jJcsgZbRqBn12m1THqwi/7miblEt3P+oJuf4NYz4d3+ tmAw== X-Gm-Message-State: AOAM530blAA2Yefc8/ajwtjjzdjkZkv4QvaAt9fhvy/TtOPsvmgnCuxr 2e13qY+syiJTJcjTfuz0GDpgZcgUPq0= X-Google-Smtp-Source: ABdhPJyViJBiaNRBLpJ7atNhqEoXN7IAlBJz7hcr000J9rd0uewpvB5HVHJd0b3WZXx/vgxi5Uj/YQ== X-Received: by 2002:a7b:c20b:: with SMTP id x11mr1421590wmi.107.1611602247203; Mon, 25 Jan 2021 11:17:27 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:26 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 3/7] bisect--helper: retire `--bisect-write` subcommand Date: Mon, 25 Jan 2021 20:17:06 +0100 Message-Id: <20210125191710.45161-4-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-1-mirucam@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--bisect-write` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_write()` 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 d65b2f44c6..0b16653f13 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -21,7 +21,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 --bisect-reset []"), - N_("git bisect--helper --bisect-write [--no-log] "), N_("git bisect--helper --bisect-check-and-set-terms "), N_("git bisect--helper --bisect-next-check []"), N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), @@ -994,7 +993,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { BISECT_RESET = 1, - BISECT_WRITE, CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, BISECT_TERMS, @@ -1010,8 +1008,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "bisect-write", &cmdmode, - N_("write out the bisection state in BISECT_LOG"), BISECT_WRITE), OPT_CMDMODE(0, "check-and-set-terms", &cmdmode, N_("check and set terms in a bisection state"), CHECK_AND_SET_TERMS), OPT_CMDMODE(0, "bisect-next-check", &cmdmode, @@ -1048,11 +1044,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); return !!bisect_reset(argc ? argv[0] : NULL); - case BISECT_WRITE: - if (argc != 4 && argc != 5) - return error(_("--bisect-write requires either 4 or 5 arguments")); - set_terms(&terms, argv[3], argv[2]); - res = bisect_write(argv[0], argv[1], &terms, nolog); break; case CHECK_AND_SET_TERMS: if (argc != 3) From patchwork Mon Jan 25 19:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045271 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 11281C43381 for ; Tue, 26 Jan 2021 05:02:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C84EB22573 for ; Tue, 26 Jan 2021 05:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730581AbhAZFCP (ORCPT ); Tue, 26 Jan 2021 00:02:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731627AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 654ECC06178B for ; Mon, 25 Jan 2021 11:17:29 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id f16so397502wmq.5 for ; Mon, 25 Jan 2021 11:17:29 -0800 (PST) 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=4ag+63Vxzue5/LXXH7lgT7VDmTGYjOaGULxBGDZSh4I=; b=RfeYFNqpO2RrYP5fc+e30S+k9Wox1soeL0qXgMUy/PmrOmVkqc8x61Io2gu89ISn85 kbsP8RYtI5jg96l5EgnH7HVecqTAUOD6Xk34wRJzszxd6J8AC6o8buA/l4fj3YUIyOmi /PI0IKdakX3wXH4cD4TUVXVIDL3hWOvE1llH8vAoTbO3QMrHkdJIpN3jJ9c3OlWsvXNg vw3R/+WTrnELqS00ngV4oPb3GzluuEsgbOJ055Wh7gmAqUi6JVpV7cr6aVeeb+/lxRPc TCeIqCiDu7gOmMipWCfQvFuR7MejK4zVmNHDc0eMgTyijiNSlUtt7yVq7FJb4cWpIAP0 yl5g== 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=4ag+63Vxzue5/LXXH7lgT7VDmTGYjOaGULxBGDZSh4I=; b=F5qG28IW/AVHZUsaBB7oIZYLMAHxgIUEa5XLVcYx2OzqsDxmJaVs4AsckeDJ2LqmHH GGzeLiKYzTbVMmHCK8ERKE3PtgpbGiXPsz/usN4jER8YVemTzGR097Xrerp23pcm2Yci jNkfRhT/s4vDgIrW24YdGO6QM7RhwWWmd/dxd3FM5HgxaUlVz3Y049MxGNVx8O/s6otP WBxslOdSA9l3ok6yypvj4WeqvTW8oKGP7X26P60zqNEEhZsKWXuvJRrGEaWeyXYAPm04 SlZyzCw4tcrdxZdfxzOabJbzOjULP81ghE+AHBmLILmAC8ZWlnHqMDDL+WOZhyyoTo60 AlLg== X-Gm-Message-State: AOAM532mBYkHaOz8fZgZ7qXBuGE0apSQ/bWez9XZ1ISn27GEMIlD63tm KSR97DxROJVgSdY5t2GUVB3/S5KtQzs= X-Google-Smtp-Source: ABdhPJwiokuIZWvkX8vnfATry9tVNrdgHQMsyCMB/eo1EO3D6Co3q90scx52AQzgrfM/iSe0UCchbw== X-Received: by 2002:a1c:4e05:: with SMTP id g5mr1482052wmh.105.1611602248251; Mon, 25 Jan 2021 11:17:28 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:27 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Miriam Rubio Subject: [PATCH v4 4/7] bisect--helper: use `res` instead of return in BISECT_RESET case option Date: Mon, 25 Jan 2021 20:17:07 +0100 Message-Id: <20210125191710.45161-5-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-1-mirucam@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Use `res` variable to store `bisect_reset()` output in BISECT_RESET case option to make bisect--helper.c more consistent. Mentored-by: Christian Couder 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 0b16653f13..8232e795fa 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1043,7 +1043,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) case BISECT_RESET: if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); - return !!bisect_reset(argc ? argv[0] : NULL); + res = bisect_reset(argc ? argv[0] : NULL); break; case CHECK_AND_SET_TERMS: if (argc != 3) From patchwork Mon Jan 25 19:17:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045275 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 33C57C433DB for ; Tue, 26 Jan 2021 05:03:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C80422B2C for ; Tue, 26 Jan 2021 05:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730619AbhAZFCz (ORCPT ); Tue, 26 Jan 2021 00:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731671AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5783DC06178C for ; Mon, 25 Jan 2021 11:17:30 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id m2so429188wmm.1 for ; Mon, 25 Jan 2021 11:17:30 -0800 (PST) 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=ybB2MQ6aSbsZbCq4sPLMz0ZvIE1tHEBXUXe4CME2QCY=; b=k6ua57qWr9HMM/3qPu3IHaCErmAGqRSdab3RWAumDsK2GQy9DDo2HnwrWAOxR0j0vd wojCB5tvzXtWAvAwEBkLCdtP10J+o8WqZ4HOwDPTl9a/eJz5cic+iuAqiv8KVCq0m7IH r1Zv18r8ZJUtzdZT9P10y5V6vVV3xAQeNB6Eog3O+0u+UhGv1vafncACYlHYtdG91+sw qTlhZ0wDLGgsjr8IGOX+H333d2+/4JSDSorEkLL1U83IIg5A/zKhVjlWmtFMFo/3jeNx ECqBmm/ACjbdqiABBsTJ1jnqgX7+9rFX1CTPKUpKRbFDVaCzKFLEDq1wwKNbE/+XpXOw L3yQ== 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=ybB2MQ6aSbsZbCq4sPLMz0ZvIE1tHEBXUXe4CME2QCY=; b=LRV+zN4muUy1lA543goEEkyacnbRI6UveZR+tMsIfCCpMFCVvEIpv7CRnKTbWB/XM+ ysWBAv4v5pDzdok1LZzZH6sxPBShvzcNTgAt/pXdlPSKJ7XBrWtX0awGAybvgmG6U9NT EaEDYCqaTKmkNsdXv9crunO+7nuFJ0rE0PjnqfWOn4e/ExlrTvhKJsz5sI002jr3NpvP dPdI83WF3rczaDgB9eTlqtV5Tn4ZAVZJWcv8zj/OUXmF/4efMmg3K4qP+hn1G/EY7q4Y n1QiEMlUU/VHgfUi6BpfkyIfK4/vZDME9PKEgaTYvvelOOP1ViqwuNdK7uuh8/rpno+6 8xvg== X-Gm-Message-State: AOAM530JgSn0kcvjHI5CywTJwuBICNCt7AgLpCz9hidrhNnox7GR1mrl BnNLvjYOzgm6POlqGDhkKuaeuoD+Ht0= X-Google-Smtp-Source: ABdhPJzCYXniTvTShngnx9ofFzIje79L1ZHNjwOC2spithE2NGf247gqOVR4213WS3bIciqhVbUYRw== X-Received: by 2002:a1c:3b44:: with SMTP id i65mr1441723wma.53.1611602249132; Mon, 25 Jan 2021 11:17:29 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:28 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 5/7] bisect--helper: retire `--bisect-auto-next` subcommand Date: Mon, 25 Jan 2021 20:17:08 +0100 Message-Id: <20210125191710.45161-6-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-1-mirucam@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The --bisect-auto-next subcommand is no longer used from the git-bisect.sh shell script. Instead the function bisect_auto_next() 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 8232e795fa..3672994c19 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -27,7 +27,6 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" " [--no-checkout] [--first-parent] [ [...]] [--] [...]"), N_("git bisect--helper --bisect-next"), - N_("git bisect--helper --bisect-auto-next"), N_("git bisect--helper --bisect-state (bad|new) []"), N_("git bisect--helper --bisect-state (good|old) [...]"), N_("git bisect--helper --bisect-replay "), @@ -999,7 +998,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_AUTOSTART, BISECT_NEXT, - BISECT_AUTO_NEXT, BISECT_STATE, BISECT_LOG, BISECT_REPLAY @@ -1018,8 +1016,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) 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-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_CMDMODE(0, "bisect-log", &cmdmode, @@ -1072,12 +1068,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) 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_STATE: set_terms(&terms, "bad", "good"); get_terms(&terms); From patchwork Mon Jan 25 19:17:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045273 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 AC5A7C433DB for ; Tue, 26 Jan 2021 05:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7857722B2C for ; Tue, 26 Jan 2021 05:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbhAZFC3 (ORCPT ); Tue, 26 Jan 2021 00:02:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731673AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E51FC061793 for ; Mon, 25 Jan 2021 11:17:31 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id c128so572635wme.2 for ; Mon, 25 Jan 2021 11:17:31 -0800 (PST) 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=/S+Og8y7Cuomg5nhyRkGBh6mxvDOMx02RqS4GI1gbpg=; b=PMBFcdnoLUSk02ygcVcw+m0Ui47Pl1qHwkXY6onAS0rkMGQckXsxW1+bzrDg/3wAXE z8TCNdY4Ufdkp0hg5HSiTxkYDgqf2CQTrEncCGiAB+39LaMmGXy3lXDf8+jO7JdOQ2HK BUNPDnAPv6HWqHK/cIQtZ5olrTQyVa17+6xgstCtMcpeBYCLp3sgUi/cs8YIanKCaZA1 jPmvRmD+Rp2Y6xydWdVLf+wUq7LXp6po65MTb9TCii7HGICWqVfPiKaSADiNl/PeV65P VnLIqYuiR644Y5+DGuJee+E9s+fSi3B+oMIjOyM5iuii6yXPEOdh+zmKY2AwYB0LwaMX E9eA== 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=/S+Og8y7Cuomg5nhyRkGBh6mxvDOMx02RqS4GI1gbpg=; b=Lr18pAgE5AaaVrnOfFcP7FbTTa5CEn5ua9Png0beVL0LABiunwKccXcjwIzY+z9rw4 1qTiPh2g+OW6aCQF0Q6Q9AKZjlB8MrRp5icqlemCoK1fUGFK6m6PQpXGwA6HzjOgZ2j1 PxadGDG7JSju1TqgjA2tXEbF4lvqxnPRwuRhTbjTs7sFG5njSbu4z4w6HzxjQxSv8fw7 pXIxmeOtnghFB/1Y9SZikVXrYmXejN7psqwzqesJ/RnCn/LTSQBS0Gr9jLMckSBd4f4u bdG3aO294CfszLb06kQ5MsymFEJWujvpLWDewk4xjB+KW0z84BmOJmAUai1PbSPyBjMW tRuQ== X-Gm-Message-State: AOAM530+vJJoq6PsnXCaSZ0t5Q/XaitwNuWUzpGnSq5wU8E4P+K7MdAt ffC1UUMntNj7U2LbJnKMv5Pd6YkAlm0= X-Google-Smtp-Source: ABdhPJx68dwkq27iDrf87mgDWQuZvtk2rRxtOejXjGjBg96kCnh3hHg4N29KLGEoQpo/Z1YA9KrA7g== X-Received: by 2002:a7b:c8c3:: with SMTP id f3mr1488630wml.110.1611602250073; Mon, 25 Jan 2021 11:17:30 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:29 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 6/7] bisect--helper: reimplement `bisect_skip` shell function in C Date: Mon, 25 Jan 2021 20:17:09 +0100 Message-Id: <20210125191710.45161-7-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-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_skip()` shell function in C and also add `bisect-skip` subcommand to `git bisect--helper` to call it from git-bisect.sh Using `--bisect-skip` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. 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 | 45 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 17 +-------------- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 3672994c19..145e1a6998 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -30,6 +30,7 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-state (bad|new) []"), N_("git bisect--helper --bisect-state (good|old) [...]"), N_("git bisect--helper --bisect-replay "), + N_("git bisect--helper --bisect-skip [(|)...]"), NULL }; @@ -988,6 +989,41 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f return bisect_auto_next(terms, NULL); } +static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **argv, int argc) +{ + int i; + enum bisect_error res; + struct strvec argv_state = STRVEC_INIT; + + strvec_push(&argv_state, "skip"); + + for (i = 0; i < argc; i++) { + const char *dotdot = strstr(argv[i], ".."); + + if (dotdot) { + struct rev_info revs; + struct commit *commit; + + init_revisions(&revs, NULL); + setup_revisions(2, argv + i - 1, &revs, NULL); + + if (prepare_revision_walk(&revs)) + die(_("revision walk setup failed\n")); + while ((commit = get_revision(&revs)) != NULL) + strvec_push(&argv_state, + oid_to_hex(&commit->object.oid)); + + reset_revision_walk(); + } else { + strvec_push(&argv_state, argv[i]); + } + } + res = bisect_state(terms, argv_state.v, argv_state.nr); + + strvec_clear(&argv_state); + return res; +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -1000,7 +1036,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_NEXT, BISECT_STATE, BISECT_LOG, - BISECT_REPLAY + BISECT_REPLAY, + BISECT_SKIP } cmdmode = 0; int res = 0, nolog = 0; struct option options[] = { @@ -1022,6 +1059,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("list the bisection steps so far"), BISECT_LOG), OPT_CMDMODE(0, "bisect-replay", &cmdmode, N_("replay the bisection process from the given file"), BISECT_REPLAY), + OPT_CMDMODE(0, "bisect-skip", &cmdmode, + N_("skip some commits for checkout"), BISECT_SKIP), OPT_BOOL(0, "no-log", &nolog, N_("no log for BISECT_WRITE")), OPT_END() @@ -1084,6 +1123,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); break; + case BISECT_SKIP: + set_terms(&terms, "bad", "good"); + res = bisect_skip(&terms, argv, argc); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index e834154e29..6a7afaea8d 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -39,21 +39,6 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" TERM_BAD=bad TERM_GOOD=good -bisect_skip() { - all='' - for arg in "$@" - do - case "$arg" in - *..*) - revs=$(git rev-list "$arg") || die "$(eval_gettext "Bad rev input: \$arg")" ;; - *) - revs=$(git rev-parse --sq-quote "$arg") ;; - esac - all="$all $revs" - done - eval git bisect--helper --bisect-state 'skip' $all -} - bisect_visualize() { git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit @@ -162,7 +147,7 @@ case "$#" in bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") git bisect--helper --bisect-state "$cmd" "$@" ;; skip) - bisect_skip "$@" ;; + git bisect--helper --bisect-skip "$@" || exit;; next) # Not sure we want "next" at the UI level anymore. git bisect--helper --bisect-next "$@" || exit ;; From patchwork Mon Jan 25 19:17:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12045269 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 53D26C433DB for ; Tue, 26 Jan 2021 05:02:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 140A922573 for ; Tue, 26 Jan 2021 05:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729880AbhAZFCB (ORCPT ); Tue, 26 Jan 2021 00:02:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731675AbhAYTSf (ORCPT ); Mon, 25 Jan 2021 14:18:35 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3360EC061794 for ; Mon, 25 Jan 2021 11:17:32 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id i9so587910wmq.1 for ; Mon, 25 Jan 2021 11:17:32 -0800 (PST) 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=SStzSCRIL9dliRtQBfGa5wPeZR1qlbqiwnb2P1Nrq+M=; b=XKRlf658AlMnu/GJTFurrzGYyjdaYUrEFzZ9CaPMHxxkrrFB9kDx1Ck92yGK9YQIKG s115GBhoPYiPjTOWQRI9TW0bol2zS3T/9fIyUeazJC6dBsCW0zOJRSsRKO4YE/CnEEmh x9+mFydL7pRiZ+au3rd6abPn5mDtEyLpv9Qb7i/lvZiU9aco60T1s5d/rjF2R1yG48Vf kMqQmIUgZJNqN4RssndmYs1PmTD9xSbtEMJdfCrtrzCYAco4zqr5XLryccRDb907XFRR rlBhAftDRvkGAiV4cULGvqz4NrencRL1JRXx5m+6hVW5lfUlS4wa9MjVD6JadIg8f1LZ 0IQw== 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=SStzSCRIL9dliRtQBfGa5wPeZR1qlbqiwnb2P1Nrq+M=; b=Gq715ThXv83Pvr/0rpLpDg7yyjShz60EIkOZdeGMfI+LoY5j4m7taUBVJAJsA/KQ67 U3GFIu555QRqjvWlGKa4hWj+ouvPA2NVVVMXVM+P3/yjU/HusPKbJWKAL0WdhXZ611m3 vwb2zNJ3u+5Af3XF4M2s07Wu8DKv8ukjP49xa9gfziRrAXaPQMUHe7ASuEBYOPCaJCrI o8mp8YuOYgFn95OpFqDVuz0lrjcOmO1RuVfJNrQWPt8qvY/TTn0dIsIf6lIVuGVuHlkA T4T/19ehLENr2AkopH/W+t205615qqhuljRK05Pa0mWAU7d3k2Ji5rZEMOouzNm9/Afe GUrw== X-Gm-Message-State: AOAM531A6xRqJMiUwq5Mkt8RKGpjoF1C92VrfhXTKq9zGHOLl3PM5ddq QV9ENuyzJjFW9W0G5VKbA6/CsVT0HJA= X-Google-Smtp-Source: ABdhPJyEiza53qqYuGtG2nAcKR13Fzq1UZ4iPuNNFOrN60TyMTl+udtUOCBNtBZCJyHS/Au7x6woUA== X-Received: by 2002:a1c:4b14:: with SMTP id y20mr1513544wma.6.1611602250984; Mon, 25 Jan 2021 11:17:30 -0800 (PST) Received: from localhost.localdomain ([81.0.37.108]) by smtp.gmail.com with ESMTPSA id e4sm11665895wrw.96.2021.01.25.11.17.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jan 2021 11:17:30 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v4 7/7] bisect--helper: retire `--check-and-set-terms` subcommand Date: Mon, 25 Jan 2021 20:17:10 +0100 Message-Id: <20210125191710.45161-8-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210125191710.45161-1-mirucam@gmail.com> References: <20210125191710.45161-1-mirucam@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--check-and-set-terms` subcommand is no longer from the git-bisect.sh shell script. Instead the function `check_and_set_terms()` is 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 145e1a6998..e26d9baa18 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -21,7 +21,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 --bisect-reset []"), - N_("git bisect--helper --bisect-check-and-set-terms "), N_("git bisect--helper --bisect-next-check []"), N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), N_("git bisect--helper --bisect-start [--term-{new,bad}= --term-{old,good}=]" @@ -1028,7 +1027,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { BISECT_RESET = 1, - CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, BISECT_TERMS, BISECT_START, @@ -1043,8 +1041,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), - OPT_CMDMODE(0, "check-and-set-terms", &cmdmode, - N_("check and set terms in a bisection state"), CHECK_AND_SET_TERMS), OPT_CMDMODE(0, "bisect-next-check", &cmdmode, N_("check whether bad or good terms exist"), BISECT_NEXT_CHECK), OPT_CMDMODE(0, "bisect-terms", &cmdmode, @@ -1080,12 +1076,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) return error(_("--bisect-reset requires either no argument or a commit")); res = bisect_reset(argc ? argv[0] : NULL); break; - case CHECK_AND_SET_TERMS: - if (argc != 3) - return error(_("--check-and-set-terms requires 3 arguments")); - set_terms(&terms, argv[2], argv[1]); - res = check_and_set_terms(&terms, argv[0]); - break; case BISECT_NEXT_CHECK: if (argc != 2 && argc != 3) return error(_("--bisect-next-check requires 2 or 3 arguments"));