From patchwork Sat Jan 23 15:40:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041705 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 A1B65C433E0 for ; Sat, 23 Jan 2021 15:42:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B7EE233E2 for ; Sat, 23 Jan 2021 15:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726021AbhAWPmc (ORCPT ); Sat, 23 Jan 2021 10:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbhAWPm2 (ORCPT ); Sat, 23 Jan 2021 10:42:28 -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 1DC30C061786 for ; Sat, 23 Jan 2021 07:41:48 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id y187so6951021wmd.3 for ; Sat, 23 Jan 2021 07:41:48 -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=y7gNm+kZ8MADy2OTi7e4OwckHB5MgAicfPwWe0auEfs=; b=aQ62wMtVrl5PvlQQsy2BZ16IYzwaf2D4+U+rDYEkls+4cmFDsQpCm2Ec3RLtInGj4Z KRS4/vIpwTUl6aYy3WuLZa9mNG9LwJenlooWLfC3uNZ3SkoM4//IQhwjhU6vvDjIq1H2 IS7YfV4FU8q50HNU0oSnQX7GTa4s7b9C5kBa68qH1lOmKOlAluCzQYaXxCX0937ZCSZH ARnldLt6wrAoK4pXLXHvmjH/egu4txWVKpfJLSGSAuTv8nrZ07MnUUsscNvJ14UUh+JS o+H5eoiiWtlnVeQ8Bh9ZPL5lo3h9EUR/sEzn60q6Pkg1d+k2UOJcfiEs5NcxoJWM2hf+ QKqQ== 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=y7gNm+kZ8MADy2OTi7e4OwckHB5MgAicfPwWe0auEfs=; b=iXI7yjealWVZJEiGRO9VKannVOhDyhXbUTyVoZZTbe5SrsLhZsfu/XSWNdD5AnE+Ln UC/KYW++k1FJJ2ZCL2igojscgiGlJE1n6dWcMIw4x5+P7RJYSuneSj73XZkZRbG0GV2S KS2yj2CHJ44rynAGs3u9+uo5VXTrrvv/NXnz5czSC8C127I4tJ14wXy8L2WDsYuQwDuy nDQbicJp2aafeLTfNHe7C0WqzoS2kqA2s3ZNlD6hrfRzh1QRpM1vELcVGao1nzGkswzr 6P0pBFdcXp6vsRBHskh47XDQPdIEnu38+L9sbXRaB/99PNCorIjUM2PlFCNDeq2cjhE6 X+9g== X-Gm-Message-State: AOAM533kWW5evYU7YlFFeid/Tr7O5qyv2ghuyjlr/G+j559Og6Dx/KJ1 hMSXHC6YHcXYSEixnOTaRZZKQquYNQU= X-Google-Smtp-Source: ABdhPJw+fD+uzXyNDrb1BMsNoP8hIU0WrHtuQ0Xd+XEdszt5HM76IlXmDiWrbO7EQAIhiNoLW2tHsA== X-Received: by 2002:a7b:c8c8:: with SMTP id f8mr8575001wml.11.1611416506926; Sat, 23 Jan 2021 07:41:46 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:46 -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 v3 1/7] bisect--helper: reimplement `bisect_log` shell function in C Date: Sat, 23 Jan 2021 16:40:50 +0100 Message-Id: <20210123154056.48234-2-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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..c6149846ff 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 Sat Jan 23 15:40:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041709 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 96155C433E9 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 615D623340 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726066AbhAWPmf (ORCPT ); Sat, 23 Jan 2021 10:42:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbhAWPmb (ORCPT ); Sat, 23 Jan 2021 10:42:31 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD30C061788 for ; Sat, 23 Jan 2021 07:41:49 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id y187so6951051wmd.3 for ; Sat, 23 Jan 2021 07:41:49 -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=6aUJrjMK0Q+C12jQSkQ0AcHKYHmtpKa9IXdaArtkdLA=; b=GEubxHBhYE8Pont5dLfB35tAYFt2o8uavygsFGRSzZMJ3c+pg2JIqnj3YAUuM4at4n A0O6jqQZsELjgzS81SidfOyJxo9HnUu3cQO79hQ/knJ8InrEOpI/AhEfG/oXmST6evxh QJW8lgisWZdc215/VfcII/VQhMWy8j6Rg6ujWXIZrwiYpFLTmn6Q8/c6I4qF1p+12sFy vEXv/JMHJMJQqdC4ogeExZIgvEhY4hYmKN75o4OxJjViFx+XAQe6kyPv/lEz4TLWxEb4 dCavdzcJ3HLGdP/zBJO2sEuNNJAMbq0em3wrsXpCAtCXZWZBT1yCRAaYO4DLBFoHv3Ru S+6A== 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=6aUJrjMK0Q+C12jQSkQ0AcHKYHmtpKa9IXdaArtkdLA=; b=qHIvzMGsbJv1dCOPSriLO/Ji4Pz1ixUO79e82ufERpu2jhSpf5Ikgm5qBb2Z8jzBrN G0g5bkR0N+/BqnSKuTCL6sqv94ZdeFDNlrC0Q0gnTFH2d1ajlNK4SybwDR+dg6El17Cy /tQXZ4MCZPL3u5pZPwZFqIzPGWStV6/iDzt0Fh8TfR/vu5A46P535GBtCBjsTqHlIs1K FqN8UOD0n7AVnFnXvDK5+8d2FEH5ex4ZGk0ImM5mn7RrpGTOZoPA7ClouOoxwo5eSL+g dGZC3Gnbnccrp49N6M0sjNzbOLnuBF7hUMFp0hHjXHscWwySJ9XaS21cnjQwTzbaKs2A 0hEw== X-Gm-Message-State: AOAM532xzH0SxHKABHUfY/nNEstkBocz7XTzPPaI/c1AnsFbvgziVQC/ VIOP/Evb7ZrZBhAUbJGWrqhTQx/a6jI= X-Google-Smtp-Source: ABdhPJz0HLJCYSaG0K7K880GZNfraMNvHKBcL6HgWKcGDYBpFrfJSyF1x5AI36Ri3Fe5sp9kLUf+3g== X-Received: by 2002:a1c:a501:: with SMTP id o1mr8687919wme.21.1611416508413; Sat, 23 Jan 2021 07:41:48 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:47 -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 v3 2/7] bisect--helper: reimplement `bisect_replay` shell function in C Date: Sat, 23 Jan 2021 16:40:51 +0100 Message-Id: <20210123154056.48234-3-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 | 84 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 34 +--------------- 2 files changed, 84 insertions(+), 34 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index a65244a0f5..4d8dca3717 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,78 @@ 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"); + + if ((!skip_prefix(p, "git bisect", &p) && + !skip_prefix(p, "git-bisect", &p)) || !isspace(*p)) + return 0; + p += strspn(p, " \t"); + + char *word_end = (char*)p + strcspn(p, " \t"); + char *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 +1002,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 +1027,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 +1096,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 c6149846ff..79bcd31bd7 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 Sat Jan 23 15:40:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041707 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 B4BD5C433E6 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CE95233E2 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725274AbhAWPmj (ORCPT ); Sat, 23 Jan 2021 10:42:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbhAWPmb (ORCPT ); Sat, 23 Jan 2021 10:42:31 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04DC1C06178B for ; Sat, 23 Jan 2021 07:41:51 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id m187so6811269wme.2 for ; Sat, 23 Jan 2021 07:41:50 -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=ilXCEUegtv3IQ27IHuMgUysHTraXcfGWEwaeksPLNXE=; b=cB/GOJYnSnZT33ihpzjBVN+XOjHb5QW+WsgEURaWV9s/pM9k2abNog6UBLp7bOF8nd JgWBrQWivrUiiPHpqyZtO5lm9Ee46q/C+x7pbeUVisfZVNVnYcK5GhCQU5Zgkr8smgq2 tJbEGhlixfHP59JZHfxJ4t7c63XDR/c2Ntd8axVpaotczrKtZe5teZzVU0ja/9BEU2F4 3w+YUs8Ezokb+A1SkZ/la8SN+wbHML3bZzFK9BJqdU5TbNsa64plunL5aRbUximI/YUZ 8IGWZ7/+Qj5qQSIsYc/64Gwd3siTjK0/0ycNA+IT1gmXOJDp9DQZ4rNISd9ZO/BFD+rO ECgA== 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=ilXCEUegtv3IQ27IHuMgUysHTraXcfGWEwaeksPLNXE=; b=eQ9nkC8Kmrb5Irgm35g5yixx4SdY6rZ+VKbWpNFA6/JOaOsz+A9rWAax3mHCBkOw5N V5fOqlgw2ljqAH9g72cirtcaW90IbVwhg3pEdnKMiE/aCZAIV1a8vibjvbytmDZu/J/d YnR87auijDF680mnL2JaZiQ3kWSyi1ZGpLIteVm1Nuoy2ZBpaZuZp8R0erRsgdZRauea H5eoQh3843frqXMsr3YbcJO/dp7v9UY0Qxl0LYaBJFymvePJNaYBL+4Je5k3xIrgR5w0 OLfOneVVVajjLCWIwptrzFT/6ugfpNpNQd/mjG+4KsUw7oRdEm89c+4umrcnF71rgz4k o2Kg== X-Gm-Message-State: AOAM530IAra6VqQIBeamoavhR4pJv5gxXiRSfO56bbUtnxFr2qUqqyZH LPlGjLGcHLJ/mYCzyFNuJHLpAmlOxsE= X-Google-Smtp-Source: ABdhPJxvcvI2prFKppP1gDUlYoRDdbN0tT8tixJjnnQSWCCPnIAOTA95/7o7SdG4EcuqrerGhQ9RTA== X-Received: by 2002:a1c:6005:: with SMTP id u5mr8762582wmb.122.1611416509790; Sat, 23 Jan 2021 07:41:49 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:49 -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 v3 3/7] bisect--helper: retire `--bisect-write` subcommand Date: Sat, 23 Jan 2021 16:40:52 +0100 Message-Id: <20210123154056.48234-4-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 4d8dca3717..1f731167f6 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]"), @@ -993,7 +992,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, @@ -1009,8 +1007,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, @@ -1047,11 +1043,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 Sat Jan 23 15:40:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041713 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 EF337C4332B for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF92233E2 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726122AbhAWPmq (ORCPT ); Sat, 23 Jan 2021 10:42:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbhAWPmd (ORCPT ); Sat, 23 Jan 2021 10:42:33 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46317C061793 for ; Sat, 23 Jan 2021 07:41:52 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id b5so7943030wrr.10 for ; Sat, 23 Jan 2021 07:41:52 -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=N7d5BGUMfOz9eoLoj7vSUfg3JBwXSYyJWhNUg/355mQ=; b=ZYyg19vv2UWxvTGe6QhvehkryvrfTqGBPOU465ReNnSTAjHYQ8/4kSaxjQlOFvXsyQ PJzHQefQ82wpXu3IHHG1tXAuDl6/kuRSvPfpFThklG9JX8H5ke0u1dhxdjdB3TK/5PwW dOuWmV6o6nEU7PBCuIHVhuZ4QtBYCJ5MYb9mZC+6rAOeAi99SnGHuQ4rRwhSxaYk61of yHlBpjhybhe/URmyOq0nDCNgeMPtuwzXrVO+ikDhd0AMu4iiLzwLcfAO+S8+0e17QD35 bDdzFvxlO3CsHxatIrMqoCShzRwHr859dm9VCFNEqTptVji52xDsXj0F7xklsa0P+q01 w1/Q== 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=N7d5BGUMfOz9eoLoj7vSUfg3JBwXSYyJWhNUg/355mQ=; b=K5BQH/8FXTEkT3WN5noMADT6AZDrYgaxFDy526kYRmoXEfjDV2VLpWh3ht+g3CZBOn /sbSX2X49A/NtxRzIdqmn3+jtwtVtk/snOIzqh83kSU+CYeyQtK2+7Jd+pWYvE2MOIjU WTihgokQ0ex/8zr95I9WskQyJSTuub04SxARIoBMMZL9jCpRMamlvXwncQgHvRHqU8rs BFPMUx9WB3uRcmV2NkkjKafAPFJN3RpWuwj8qQf89Qo/038j94O7ZBmEmjz3SMx8H2hB 2RtpS5PNq+yfoB5jIJTsK2ofrxL4FuMHIqNB87As8Vg7VTYsClxggi+bt8yKQu+VPwjO lrtQ== X-Gm-Message-State: AOAM5307sPSa43PygmNvZqyBC/Vrtz9rReqL2aB3kA++TNQlOZc0Pd+i Nagb9TIsfbGbijZ0M0shYbWhjRf629I= X-Google-Smtp-Source: ABdhPJy9eS4c9kmJSdecLLriLuHkcnosNQWcziUirgrZDQg9tp39OFzdHUclfxONPVvozWyz0Eeq9w== X-Received: by 2002:a05:6000:2cf:: with SMTP id o15mr1059064wry.184.1611416511104; Sat, 23 Jan 2021 07:41:51 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:50 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Miriam Rubio Subject: [PATCH v3 4/7] bisect--helper: use `res` instead of return in BISECT_RESET case option Date: Sat, 23 Jan 2021 16:40:53 +0100 Message-Id: <20210123154056.48234-5-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 1f731167f6..1ce0399ad4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1042,7 +1042,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 Sat Jan 23 15:40:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041711 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 DA7E5C43381 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DC7B23340 for ; Sat, 23 Jan 2021 15:42:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726119AbhAWPml (ORCPT ); Sat, 23 Jan 2021 10:42:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbhAWPme (ORCPT ); Sat, 23 Jan 2021 10:42:34 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957DDC06174A for ; Sat, 23 Jan 2021 07:41:53 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id r9so1313356wro.9 for ; Sat, 23 Jan 2021 07:41:53 -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=CFYa0euJy6W/rRv68hk7qePiLgkQVOOBw3w1miWkKTI=; b=D4r5cWbx8JlozzubYWXAaYeg9qBgQFiZ2Kzom8zaVcED4d7G/KTZcX6qV2nZFMzVg/ Jzez798HJpzGip7DvJiDBiRg4h282OlDmUaVm1GEEy8HgutTJEd5aPvH1VPjgdc8DbOI N/kqHAof8G/MAFahwza6NQ2BDSJCv8/yUvN02HMSADorftYSTqS1By+YLbeDcC76+qNt y4QRaSuUaL4dAMMRj1O6fYwv7TqOscFoWY8cFqzImjweQoEDWRZmFuGOPC4ftPSzoWtx GQYGGc2uDtQARUw1CmpaP9B5IDE2bkR92Av+YVrWOSlh2O3ANkhC7bTbtSfJ4rwgzdh9 IqUw== 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=CFYa0euJy6W/rRv68hk7qePiLgkQVOOBw3w1miWkKTI=; b=VinlH5Wik9gzNIAO3QvKNFCK33FdgiZW4Zya8kxuKHkQm52rPeuNcOA7r+f11KeOvv i62QI73lDGohGRSn7lK118ELpRM0DMC3SXT+wgdEoeUUqqJts5wH1Jk6fneEfQ5DO0fk u5D3BGIE0DttgkUbax30c8rp+I4DDs4sZPLP2qUHkFoEgMVS+BG6FCRGIJrLkGJCULYv gJmM+dqlLFbCAsDfbON92asJBNlqJ9A6QDNW39Xf1YBB2u20LVEZAuKB5AxaOZ5UYcNN krOYLvSyoZr6zJmAuYm2aEeAXdst0WSrgjnU4WK6WfCuitBFyTNW71t2eOaVDgpdm7+R cylw== X-Gm-Message-State: AOAM530M128HLZ1bY/nejpUGWmgJ0/+Yp9KxsW0LSdL9yKhMvD4Y34f1 LYy+ABgyj0pYxx/0bGT/Ym+5GmiYQHE= X-Google-Smtp-Source: ABdhPJxwpE9BMo5KOUNZ8ZwOPQNIpFYqU7YDie7tys/f+07cLevzpz8SUelxGSbeAvSeV6qtm+f6TQ== X-Received: by 2002:a5d:55c3:: with SMTP id i3mr9477772wrw.190.1611416512307; Sat, 23 Jan 2021 07:41:52 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:51 -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 v3 5/7] bisect--helper: retire `--bisect-auto-next` subcommand Date: Sat, 23 Jan 2021 16:40:54 +0100 Message-Id: <20210123154056.48234-6-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 1ce0399ad4..1e53845e69 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 "), @@ -998,7 +997,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 @@ -1017,8 +1015,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, @@ -1071,12 +1067,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 Sat Jan 23 15:40:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041715 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 54D1DC433E0 for ; Sat, 23 Jan 2021 15:43:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FC6E23340 for ; Sat, 23 Jan 2021 15:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726149AbhAWPnM (ORCPT ); Sat, 23 Jan 2021 10:43:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbhAWPnI (ORCPT ); Sat, 23 Jan 2021 10:43:08 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ACE6C061794 for ; Sat, 23 Jan 2021 07:41:55 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id v15so7947846wrx.4 for ; Sat, 23 Jan 2021 07:41:55 -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=MKV0VC1SUcPkTQL0JeTYDy+yzBhRPgxMJyS0MYrjpHI=; b=AD8M14rp9xlsuqbwfvkBAQXnJ7gUJfbq1srPIaM1D40GVnGOSgpiI2UkSOQEvE4eud KlfUIu1R/mJ8Arkxa3LduaEvbGSH4Tb3HKaVLipyj9p4Ktz0GOzS/IOXmlJS0uJNOpX9 FBYV8yU/JXAYStxkreeAUN7c2kKFr3P4PSAy0JYct5KrJuXyFYORXTAJYAO4sP8yr2Ue zEqnot1oIX+4q38YpaOWrxWhi+QZVNi4K0OpqVlxinLq+rBJE6McsQ0Fn7izVnW8kWhn /OOS95geIBgrsKIOiqDUaElKT39dpP9068bMus60scG/CMT3UvdE70CIVF3IFG+tEhEp 6JMg== 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=MKV0VC1SUcPkTQL0JeTYDy+yzBhRPgxMJyS0MYrjpHI=; b=ImseA4LtlmdB4Iown6BnZ3InGhzyxsaXUlRT/J+D7+dmUPBBwH0X9VHeMUg3lzbpXn t7WxcCtN1ex2CvOLZrbbqw/qADMLzpUdeFsduCJQ8qHxiwYhD63Uq5t3QysnhKq/u5Up BKgBk/Yt3bEsGWBotknjdtH8D9vICsrAmMrL7vdv6ahUsM1baJvpWrQpL1ofcG54dW9A wOf+grYyBkplE/bT+qlrK0upE67jOaazGW0ptGMWJCMlWgQ+21jm5gM0xr7U6/2NIgQn xiwi6ngxmtUmDqXYmszNmHwr+VgRTGnQOmBPf0q57+Jk2KNJdquIysEeO6LQoy6PdaMG k2hQ== X-Gm-Message-State: AOAM530VxQp9OfD4a5R6afxG+SSV2pyhDW8maxmXjBOPDS+tjvkJpDbR b1rx0SyFVixlSFTHxFlaTBUImPPG5+o= X-Google-Smtp-Source: ABdhPJx7U3GD4L4EvRxikNp5jYa5TaOtKQwanHz3aDQ9uyES7MroR3YIHTCqiLrtLTpUsWpI+uMfYw== X-Received: by 2002:a5d:664c:: with SMTP id f12mr9474759wrw.61.1611416513795; Sat, 23 Jan 2021 07:41:53 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:52 -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 v3 6/7] bisect--helper: reimplement `bisect_skip` shell function in C Date: Sat, 23 Jan 2021 16:40:55 +0100 Message-Id: <20210123154056.48234-7-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 1e53845e69..61ddaa6b9c 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 }; @@ -987,6 +988,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 { @@ -999,7 +1035,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[] = { @@ -1021,6 +1058,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() @@ -1083,6 +1122,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 79bcd31bd7..016cc34e03 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 Sat Jan 23 15:40:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12041717 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 7246AC433E6 for ; Sat, 23 Jan 2021 15:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 474F523340 for ; Sat, 23 Jan 2021 15:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726162AbhAWPnN (ORCPT ); Sat, 23 Jan 2021 10:43:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbhAWPnI (ORCPT ); Sat, 23 Jan 2021 10:43:08 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46EBCC061797 for ; Sat, 23 Jan 2021 07:41:56 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id d16so7281569wro.11 for ; Sat, 23 Jan 2021 07:41:56 -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=InwhpkEI0WqZil2a/LbOllLSCSMbd7WLpAL7F57X3qI=; b=OWhekC0BIUAmZjGSUXt0KDQVIoWcoq7CQ2h5Gv7rYzJ4QJybM9jsfzmRt6NtGLP7Fe 2n6ZZ3QzZp6UOFhOroxh7puI2tbzYfxTiwPXmemqsQcr+8lSABStpzxuEcdW9EvY4HbM 2K4hCAlgMJHiggIgqOCN9olLG4ShJiX7QeNar5IlgCwnKqVgzUCGIm7USqODv0Yx4t1Q yUuXG6BihFxFYwU2sHhjZKhtBPMTbDd2c0VZqmogxMNdg03Vok0NETibMMnaWjXqjUvZ CNDx/paHc1FHWaRnnhRfzBaCjLtfql0TyJobMunLY+4EPPT7l7+Iv4DDlj9avl4+F7CR LZBQ== 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=InwhpkEI0WqZil2a/LbOllLSCSMbd7WLpAL7F57X3qI=; b=HeTyPQfuD/VYSaILRlnhUk22nPpkCScDL/ynF9JzaNAyU/X02MqRuzjePY7WMj94iQ xDLqXDDQKOM27bcZAYtWCqFLma8MVATVw8Q9GRvclNqSNIrZTVWcJwsh2oSb+zCUhPTO GlMGr6BDSKgBqKubO91WvVmR5Xj1qQ/LdLc7rlLFlwQpqaHUpntv+DJoafequTjAQBX4 R7gMLVuLy6+ifOEsDDVqtI1mst/WXA33vt1f0qFg1uW1oNVMcKev7vTo16N4NEqcGo/1 Ai3akazVyV5cjbKDu6dqE65/WyZSqY5ww5rlALxVkO9R8RTpImnLl7REiWkA6tFD1GjK uDOQ== X-Gm-Message-State: AOAM530M+7PxMOotOIbAgg2Kro4m2IRvz2uNCY3FAip/7U5oGuszP3kc nkR0YVEgLZ7Xa3r2f4ZWvRZSmUdMNMk= X-Google-Smtp-Source: ABdhPJyZJoYg5fAHczsRCWbzX8C9IjKiXMYu9Ddtzkq6hRCRgtx8SrYY7FvzjQ7IpJtVu2hxCb8e8w== X-Received: by 2002:a05:6000:8a:: with SMTP id m10mr342338wrx.139.1611416515111; Sat, 23 Jan 2021 07:41:55 -0800 (PST) Received: from localhost.localdomain ([81.0.50.72]) by smtp.gmail.com with ESMTPSA id o8sm16772353wrm.17.2021.01.23.07.41.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Jan 2021 07:41:54 -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 v3 7/7] bisect--helper: retire `--check-and-set-terms` subcommand Date: Sat, 23 Jan 2021 16:40:56 +0100 Message-Id: <20210123154056.48234-8-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123154056.48234-1-mirucam@gmail.com> References: <20210123154056.48234-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 61ddaa6b9c..3b0a6a7d0c 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}=]" @@ -1027,7 +1026,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, @@ -1042,8 +1040,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, @@ -1079,12 +1075,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"));