From patchwork Mon Dec 21 16:27:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985089 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 CFECBC43381 for ; Mon, 21 Dec 2020 18:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F31C22D49 for ; Mon, 21 Dec 2020 18:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726429AbgLUSOb (ORCPT ); Mon, 21 Dec 2020 13:14:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbgLUSOa (ORCPT ); Mon, 21 Dec 2020 13:14:30 -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 D860FC0611C5 for ; Mon, 21 Dec 2020 10:13:49 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id y17so11999115wrr.10 for ; Mon, 21 Dec 2020 10:13: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=1SSxn00D6lEx94ttp23aI5Puw/LoAFasEmLcpM5Su8k=; b=W6gC6Ivc+PX4exDRa+He2CoORIvENH6xVehCOdrIPI7D6JubhMBnq2yaqCuxwOjSur h310059ZHjq4GdYTSRrWaglH5BqSW567FV2N3BWIleggY4n5FywUpOW5g2q+5YTjZtLu spXX8oWPNUAu9eLoMALdj89VOurk6/cOFlV+V/1ectETOJVrfSFR3GubQkw7grbU4qaZ 64p30ESZEu4jntpndrcdbCthOFXxj7YGBwL2TgYOXUIj+oqIW2Ew9tE9DRan53SVd6mA 47QxdZTxSCswJCoWy7XsUKqh2SY/mBg7OOaG0Hq2FJTKjKjWJCGUWUCxOzyiWTlWOn+z 7cgg== 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=1SSxn00D6lEx94ttp23aI5Puw/LoAFasEmLcpM5Su8k=; b=O8dUNOW6gNWinwX/xQi5KmCIxvs5U42D0SbEdk7yROOxjNTWXnqm1p3UZc22rpbZ08 h6fQ+OqUtqnwX3XIk1tg8d3YlUyEFTXhf+jzlj7N+y1eqySWAmGnC+OjSHgq8qCR4Ye5 QX/9ogaSf/5o0RzRslzYhIPPGSJ/pj8aot/1pYwjcIUuhNJGgFg5pdu2Ggvhj9YJMqbX CtSivrQKVM4YQYJKAPdeb4yOpNTtlz51g2Aa410rKvWn3SiGgCcVYI+H137iHj24hycz VtPHnK477nYLeW2jMxzSFxDWh8lJvcpaxEBVaDVlMv3ydlmHP/T92VLEEJd3vPEiykhC hlEw== X-Gm-Message-State: AOAM531Swcl9Sm5tAYN7Nvcd+ZYRCaZu2ovurJ10nFsNb69TyQDEMg+j 8mpO+h/y/0Ca/2f9fe7Q5YEavPpwlZaAqw== X-Google-Smtp-Source: ABdhPJw+k4y/TVrOXG56FvHWxzBuvGba+P0XM+c/LOzxYmXURh5ObcIAoDtTcbY8XfHVELPEd2wGjw== X-Received: by 2002:a5d:6cc9:: with SMTP id c9mr19105366wrc.411.1608568168393; Mon, 21 Dec 2020 08:29:28 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29:27 -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 v2 1/7] bisect--helper: reimplement `bisect_log` shell function in C Date: Mon, 21 Dec 2020 17:27:37 +0100 Message-Id: <20201221162743.96056-2-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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..1854377fa6 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_("output the contents of BISECT_LOG"), 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 Mon Dec 21 16:27:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985137 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 72C0AC433DB for ; Mon, 21 Dec 2020 18:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4119322D08 for ; Mon, 21 Dec 2020 18:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgLUS3S (ORCPT ); Mon, 21 Dec 2020 13:29:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbgLUS3R (ORCPT ); Mon, 21 Dec 2020 13:29:17 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DEDEC061282 for ; Mon, 21 Dec 2020 10:28:37 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id x22so10754106wmc.5 for ; Mon, 21 Dec 2020 10:28:37 -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=rJqhNm87GSjCdCywAYJpS4qIgGDyQgol4K63s9C25jQ=; b=hz/5wd5pGXchAaQBhmLv87KDI4MjpfV/UEQ/ElCdm3tQ0HSSv5+jRpbShmn6/LsCcW WeladbuBF67Ic3a6ND6LJYglcG0RSbnHwWVxLIVr4VwU/lbfvOG2LKhPpC/SzD+bvlmH uHtheV50pEN7aWPLRRlU2hohgbnXdZk8A4whICGc6mfmXgrCRtg1a1WyjegXUJ6/fYsr Fh4UzoACNTjLnN3HnGPuIfC7HT0lTHTfG81JQnLf0gJCLwnvD4iUi8C0mSfsjCVNFpD+ m6OTNHtAE0cp7szptq7dXWl7D+vOTMzkow6tX04G//vPycbCn74sPCYkvbBMyP0lJPDX hsGQ== 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=rJqhNm87GSjCdCywAYJpS4qIgGDyQgol4K63s9C25jQ=; b=nvNq+MDuOWSPl4NcJAt0BimHWDnwhs0HZFrjCCTAuOlG6l+ioAyvP+1LJ128kkHFxt 0hSJqUvw0K0zRFsNTZ9DIZqJbk27Twh/kJBDSzyRBIkJNHqBj31FQ/vm8/CWaFn1zApb EbvgKfP7T9IJDY53CNBHovtfRI2/ksZyDzydKUO1/xZxUF+pEOYMm+RpAu5/rdtTqx4A w4i3IyJWqesxG+PP63fBvj80WAfDWG7ih2HDulV+5NuJLSDAtpyTmMBzMpPO+Vn91ige ZGOmMEQqx3k0q0QjHtdiWn8BosdR/lcxgbLmygZI6uwK8dMWK4hgQZs4YXGJsuVHBqFQ GxtA== X-Gm-Message-State: AOAM532+TlCqKx6L/MYqjQ6KvTno5zfYLyFG5btF9XKTjeUlO2FFEU33 ZDkchV7EK0krYGJj0g/zvA4pYS0ea67XLQ== X-Google-Smtp-Source: ABdhPJz0yNA/mkH82QxR8A8Nhg7gwq5S4Bz3BvJZa4YjQnnIv3vxGgQpEarkNYOVNOuexlqc8hCNWw== X-Received: by 2002:a1c:2155:: with SMTP id h82mr17210194wmh.132.1608568169437; Mon, 21 Dec 2020 08:29:29 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29: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 v2 2/7] bisect--helper: reimplement `bisect_replay` shell function in C Date: Mon, 21 Dec 2020 17:27:38 +0100 Message-Id: <20201221162743.96056-3-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 | 127 ++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 34 +---------- 2 files changed, 127 insertions(+), 34 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 1854377fa6..92c783237d 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,121 @@ static enum bisect_error bisect_log(void) return status ? BISECT_FAILED : BISECT_OK; } +static int get_next_word(const char *line, int pos, struct strbuf *word) +{ + int i, len = strlen(line), begin = 0; + + strbuf_reset(word); + for (i = pos; i < len; i++) { + if (line[i] == ' ' && begin) + return i + 1; + + if (!begin) + begin = 1; + strbuf_addch(word, line[i]); + } + + return i; +} + +static int process_line(struct bisect_terms *terms, struct strbuf *line, struct strbuf *word) +{ + int res = 0; + int pos = 0; + + while (pos < line->len) { + pos = get_next_word(line->buf, pos, word); + + if (!strcmp(word->buf, "git")) + continue; + else if (!strcmp(word->buf, "git-bisect")) + continue; + else if (!strcmp(word->buf, "bisect")) + continue; + else if (starts_with(word->buf, "#")) + break; + + get_terms(terms); + if (check_and_set_terms(terms, word->buf)) + return -1; + + if (!strcmp(word->buf, "start")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(line->buf+pos, &argv); + res = bisect_start(terms, argv.v, argv.nr); + strvec_clear(&argv); + if (res) + return -1; + break; + } + + if (one_of(word->buf, terms->term_good, + terms->term_bad, "skip", NULL)) { + if (bisect_write(word->buf, line->buf+pos, terms, 0)) + return -1; + break; + } + + if (!strcmp(word->buf, "terms")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(line->buf+pos, &argv); + res = bisect_terms(terms, argv.nr == 1 ? argv.v[0] : NULL); + strvec_clear(&argv); + if (res) + return -1; + break; + } + + error(_("Replay file contains rubbish (\"%s\")"), + word->buf); + res = -1; + } + return res; +} + +static int process_replay_file(FILE *fp, struct bisect_terms *terms) +{ + struct strbuf line = STRBUF_INIT; + struct strbuf word = STRBUF_INIT; + int res = 0; + + while (strbuf_getline(&line, fp) != EOF) { + res = process_line(terms, &line, &word); + if (res) + break; + } + + strbuf_release(&line); + strbuf_release(&word); + return res; +} + +static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *filename) +{ + FILE *fp = NULL; + enum bisect_error res = BISECT_OK; + + 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; + + res = process_replay_file(fp, terms); + 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 +1045,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 +1070,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_("output the contents of BISECT_LOG"), 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 +1139,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 Mon Dec 21 16:27:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985125 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 6469DC43381 for ; Mon, 21 Dec 2020 18:21:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 332AD22D49 for ; Mon, 21 Dec 2020 18:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726039AbgLUSVx (ORCPT ); Mon, 21 Dec 2020 13:21:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgLUSVx (ORCPT ); Mon, 21 Dec 2020 13:21:53 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4201C061257 for ; Mon, 21 Dec 2020 10:21:12 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id 91so12047359wrj.7 for ; Mon, 21 Dec 2020 10:21:12 -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=AN2/2LBOVeLGSx2IKzATLVFL5GwDYVgFjT8qBOFVWEk=; b=n+TibyreZcpvRCgGjN2QAhSVY3xr/QS8WsdbQ7mbS/hjLZkay/VmAbYNksGUEaA9V2 9cIB56/TJLOivM1V4x31K3/a5ejDA/nv8aWddCkVKEJhb8A00c3xc47tM40cfftyp85X O17zaskfSb3mtBevCBUJPo6vMIXT72yb7ljTeE91m5FbaxRBEbp2XeD41+nhxPTtKMUV XyPA3xyGU2YqUC+fgwFqHKLn9zOaekN/5qHZuXIRmGFfju7ZqAUTmL+CWuLOmiAyGxJC /EaY3r5GTFg9YpmCn/TLFgqCKuqYzzQz3CJphpker6w06rdx/amLTIugnRufSn47wVzD yNnQ== 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=AN2/2LBOVeLGSx2IKzATLVFL5GwDYVgFjT8qBOFVWEk=; b=VKQ7VrYvFwCX5drPmPgL1apPLwMPMb9b2xMdXnYTFZJj3sHfuTXiuYkR3ATNXMHiTT uBPG4TrAGV9YvGFWSHa8BMxai4ikRrw0CStPFO9vIcE2AtRCe/f4cqtObHhaMC0dKpPB AwTaOV8ih8zvyYpY9Dk/D957423SWJ/ZIk9U8nWIOn0FmJ+KWqZFVsub8XZ0RTiF482P 3yIVjCQmSaGgaUvZA+a52KARGYFb/hWWVSGTO0NcZeNxcABP2hUxhPSi1UhygYdgGnod C0Y2zfyipX3iVdkXnLIVzVos2rdojplNZFr90J69UaeB+j7Ip9vhKaZJGrlfMwsCFX6A lOEw== X-Gm-Message-State: AOAM531tpg7c2nDWcmf1oeZPOYwxqq1iqdq7eGOcgScIMmVwLLkY4Vot fkSvHTa9d+v6j8npMvhobUOUk+TbciRL5w== X-Google-Smtp-Source: ABdhPJy8aez7UpceM3vh9c8Qko5RCJLbhwvuAenSQ0h6KBGspROb7Yfz/eCkgVLgUlw1ORiLezBu6Q== X-Received: by 2002:adf:dd92:: with SMTP id x18mr19566913wrl.311.1608568170654; Mon, 21 Dec 2020 08:29:30 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29: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 v2 3/7] bisect--helper: retire `--bisect-write` subcommand Date: Mon, 21 Dec 2020 17:27:39 +0100 Message-Id: <20201221162743.96056-4-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 92c783237d..896c54f869 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]"), @@ -1036,7 +1035,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, @@ -1052,8 +1050,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, @@ -1090,11 +1086,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 Dec 21 16:27:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985135 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 B13B1C433E9 for ; Mon, 21 Dec 2020 18:26:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 859DF22D08 for ; Mon, 21 Dec 2020 18:26:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726700AbgLUS0i (ORCPT ); Mon, 21 Dec 2020 13:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726625AbgLUS0h (ORCPT ); Mon, 21 Dec 2020 13:26:37 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66587C0613D6 for ; Mon, 21 Dec 2020 10:25:57 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id e25so11896591wme.0 for ; Mon, 21 Dec 2020 10:25:57 -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=3r7mtXInoIgW9xHjAGWVPhNwI0akWriajwOoDVsErOw=; b=dB5jKvL3VC+ftnzE751C/30X2hBbh1+e1eUqMhaoyKl2GZjgdz3vLn6kR+Mp6GGGt5 3sm0P80Cl28cjlMsR++OwnW2j+m0rD0nawD+3UkMMehP06kpzhRKPR+RYD0f4BnVAnuQ buZYd2jHO//mKtuW5v8JZzUyllCsrpnY2OJ8aM2VNOvHlE/glJqpkYcEiHom9d8eS304 TO1FswYcuYzElYv8pHMBBFBF3y6YVIcPQrjcXHE3yLdhNfQfI2eJUbrM0C/kVXZ0VGnt r/Hb+MqxX5pzNBUcdm3J6QbIu08+ecHzla8PIKUYc5s/mxkKytFLRSWxROogvPvum49D cPfg== 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=3r7mtXInoIgW9xHjAGWVPhNwI0akWriajwOoDVsErOw=; b=abxHEiZHuBvWhsL7pjG1307x/UzxEfeUCotEFvWjeaW3kg1ZPETns049fR0lO90A2b nRjUfvDVn7iQswjPKzgHFNTrpiK8ohgGHciol48HCGJWbBKo7dRDuz14RJwyT8oSBkCS PS6jCkq1v3y0I9cuPa7urJ+SXTOTcbNx8nX24eJW6AX31lwugrDqTdPFVj3v6xAm3HLw 2x4JDrYXEeFlH/lJ0Q4xoL70PyfKfJPU4uqCOC9BbvQTxbnc8Tu4KBPREBqBqBZcgPZ8 F5j5iQdfO2wEXMBjMb/loV/mhiHnZXwGfHILVkcMRPQB5F+dtbZlZwoqjR71q3TpGVlr y1Yw== X-Gm-Message-State: AOAM530thNBIF+Hygef7nSFMkAnzQbO4sc6jdbuthGO1gTWsUzSVS0y2 Y0RdZHXkFJoI+f1wtKU3EkTfn9fufY+MpA== X-Google-Smtp-Source: ABdhPJzOswkb/vYYdDUKjwzAyBMgU1mnbmnx0JsgfWaIweQe8UapVIMsUejCM1iZ1McTCP4q1C5tkw== X-Received: by 2002:a1c:1d85:: with SMTP id d127mr17870860wmd.49.1608568171520; Mon, 21 Dec 2020 08:29:31 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29:31 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Miriam Rubio Subject: [PATCH v2 4/7] bisect--helper: use `res` instead of return in BISECT_RESET case option Date: Mon, 21 Dec 2020 17:27:40 +0100 Message-Id: <20201221162743.96056-5-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 896c54f869..e2e568823e 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1085,7 +1085,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 Dec 21 16:27:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985055 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 B5543C433E0 for ; Mon, 21 Dec 2020 18:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F2D022D49 for ; Mon, 21 Dec 2020 18:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725937AbgLUSEI (ORCPT ); Mon, 21 Dec 2020 13:04:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgLUSEI (ORCPT ); Mon, 21 Dec 2020 13:04:08 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8045BC061793 for ; Mon, 21 Dec 2020 10:03:27 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id q75so11806781wme.2 for ; Mon, 21 Dec 2020 10:03: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=6tiXz/t4UiV/XSnd2ixEMzrxraYDb6koYQUu1uHN3t8=; b=VcThca1p+xhcmoJByr2dpv7tqmcSL6/0qeahXff+I4HGTx3VVz4Bz8ByDfb2Ze3O7K ygbiLMZw6mpgRhhjo+z2cwB5b1zvZ1d3K0gSV9b11AZMTre+NETVYK4eVsJTYC5ltQOM 8NA7LHYwmPub21uDdNDNaea9XcPJaPoo1UokNhdHeQWEvV/ICo9s49E28sAlBofNMzzW HvjYyDMm0CUsLGG0UspUsdylnPqUkWurHz9geY1AB0EOteeow86Fz/UD9aW1vn/HDTe/ sKF+xSa2j7as+jAyqgbL4e4ZEquTtjFsiRNCFwRGXC227O8lFBZQDXpcXiAfkGFIbSFM XSyA== 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=6tiXz/t4UiV/XSnd2ixEMzrxraYDb6koYQUu1uHN3t8=; b=q8OEkgfYEgdAzSVlW80ngB715YDMDFw37ewvsJ67mAPuivlVKp/nAa3etiHa3eUSie k2WSYQEAkTtyFX3Wu+wE8aH+/iiV8rfKGd+BDbYAA7N01fFoIfuwR2PQ9X4dhVU9kdNb 7KrWNbdHfrO7hctyxBAl2l4i9YaP6Bv7siQAcRo6+cLt6QFwQ0kO6nSJ3+bXUgPvzXPS neaBAAeex7SruW+YITvLIlB3b6zLaUUb8vdODRiQO2NUFTSKV9p6FVSyvsvQA6wVmbJT Ob52H5mHxqQXI4tWswLVvdczkk051IKA+gNM09H1jZLfKrLuzRt3cf90ekPU4pAFI3Cx FVpA== X-Gm-Message-State: AOAM530C+mkcNSE41Mlk6yNVkAC094NFeqWci0NE3X/jP7TVX/n0fb1a RRaGjVDB5oY09lNWNBZ/KaTuy2O6IYiq7A== X-Google-Smtp-Source: ABdhPJwoMma52ze3aBC/QksBxtD+v+mDCDINm+j55Gi7KaXd48YWAn1xuQ2OmIILEpbmjdZfYJSaKw== X-Received: by 2002:a1c:4c14:: with SMTP id z20mr17668153wmf.149.1608568172415; Mon, 21 Dec 2020 08:29:32 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29:31 -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 v2 5/7] bisect--helper: retire `--bisect-auto-next` subcommand Date: Mon, 21 Dec 2020 17:27:41 +0100 Message-Id: <20201221162743.96056-6-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 e2e568823e..d570a165de 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 "), @@ -1041,7 +1040,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 @@ -1060,8 +1058,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, @@ -1114,12 +1110,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 Dec 21 16:27:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985057 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 1B62EC43381 for ; Mon, 21 Dec 2020 18:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F132422D49 for ; Mon, 21 Dec 2020 18:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbgLUSFj (ORCPT ); Mon, 21 Dec 2020 13:05:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgLUSFi (ORCPT ); Mon, 21 Dec 2020 13:05:38 -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 50753C061285 for ; Mon, 21 Dec 2020 10:04:58 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id c133so10706830wme.4 for ; Mon, 21 Dec 2020 10:04:58 -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=7UBmQ2+DuS9zvp0BUmDz70iD9CWedUfU1RNe+O6OvKY=; b=exH4FBEE97uJHmWgMqsGyXSjCo7jJLkRsLi9+xKbPxHu327OHYfLQhyJTKWsMHZq0Y rrlmgBCn3ggO0dl9M1SJtKIv+mczt4m3PNQZ4KRAscNP1TcT/svup2rkYnXjkgUDT195 fUzpxSdySIz863sFp5Qco1rS890a+yGF50NbVmqB4RUNjFh9KgODL2WPR7US35c2uvrT 70AKE4irEcNKIBN2xcsq11piAx9cKG5lK3NhJrJkYlhTtaWQRuiOZhfom0kzZRbTVNOK JBnyUAtxfzjlwqCn9hDN6J9hRVtD8ZI6+Gq8YVhMEogEVHlQtntrS0hFcGgBeVtWSU6w SxZw== 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=7UBmQ2+DuS9zvp0BUmDz70iD9CWedUfU1RNe+O6OvKY=; b=g1o7ND4jj9HABuZ7NTcTkwIV8W0t+vp8uKy+GF4Oh6TBxKWSIiKI9Qur3Kjl0Zl/UE 5vM1wn5U1MnAtH+PiFJBfccwhlcf5Men6uOCbl5/gU5iuxO3a1nJuxD7ekJLI8GkWcEx kNtq8SXZ738xoddfWabsJFaKEQq9eSXNlzOxyjoaKHZ2Irkz2vLTPF4IbL7GaOeATGPK VKVjXe+wWWrIf8p7+U1gTc1hHvw8v0CNjYWIQGEv+aFZOILSfmpRGLyr8U7z22c+hjqs BwaDILg3nmpbcuMgbM4ehTRL2pfElHOH+yNznhtyxTSLcyjIGJkMSadk+nexTjgCwJoU E6Ew== X-Gm-Message-State: AOAM532EitqSED4mRdgG9dJfsKWRljBHF39iEpjcxe7IBALTs4dKCb0K E7qXETzrpmgm16CiAGV12xoZLfGiGX0Gzg== X-Google-Smtp-Source: ABdhPJwDXUQl9Y5PBFV2YYnJiJgkoyYH2YksWlGa2FRpbLk253zpnddbj4uLkhydPbX/PQSah5kmTg== X-Received: by 2002:a1c:2c4:: with SMTP id 187mr17707426wmc.187.1608568173423; Mon, 21 Dec 2020 08:29:33 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29:32 -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 v2 6/7] bisect--helper: reimplement `bisect_skip` shell function in C Date: Mon, 21 Dec 2020 17:27:42 +0100 Message-Id: <20201221162743.96056-7-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 | 47 +++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 17 +-------------- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index d570a165de..1a6c75183a 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 }; @@ -1030,6 +1031,43 @@ 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; + const char *pattern = "*..*"; + struct strvec argv_state = STRVEC_INIT; + + strvec_push(&argv_state, "skip"); + + for (i = 0; i < argc; i++) { + if (!wildmatch(pattern, argv[i], 0)) { + struct rev_info revs; + struct commit *commit; + struct strvec rev_argv = STRVEC_INIT; + + strvec_pushl(&rev_argv, "skipped_commits", argv[i], NULL); + init_revisions(&revs, NULL); + setup_revisions(rev_argv.nr, rev_argv.v, &revs, NULL); + strvec_clear(&rev_argv); + + 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 { @@ -1042,7 +1080,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[] = { @@ -1064,6 +1103,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("output the contents of BISECT_LOG"), 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() @@ -1126,6 +1167,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 Mon Dec 21 16:27:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11985127 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 EEBDBC433E0 for ; Mon, 21 Dec 2020 18:24:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B001122D08 for ; Mon, 21 Dec 2020 18:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbgLUSYv (ORCPT ); Mon, 21 Dec 2020 13:24:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbgLUSYu (ORCPT ); Mon, 21 Dec 2020 13:24:50 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FFA7C0613D3 for ; Mon, 21 Dec 2020 10:24:10 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id a6so10754672wmc.2 for ; Mon, 21 Dec 2020 10:24:10 -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=B6QF7F1Z+JqlJufBL11EO6a3iYF40ejzq1mLY460EEg=; b=nCKRiKI9o0vTHOweNu9Q10UD0T9rjE2MIcCytQ8ATunSSuvVwPST/qLJDaEh173eSr TxbLi50HWwt8s32LpKlnbxk85548b8/zDKocZWNydr7JCjFjqu0OLHJSRPp3V+G5lClX RuGZdBaCU++hcBCBrVAFqyVLMjukqGCfI0bM6cHWKt1Zz/M/6RE1VL2JmHXB7hNkZ6XW nkLjlvL/VcojrXcevsM/SVcegySUZrQnPf+T9WYiglzvj4NOQ5LtDAa/vPvuMLZ5mFUP sUv/+HpVwRWj4oyZaAyCcCmPNmC0ppTXE6dfSbMmW0dWhK7nJVfKLOBAmBDS7Dvwjjbi 6qvg== 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=B6QF7F1Z+JqlJufBL11EO6a3iYF40ejzq1mLY460EEg=; b=eRLkhDju0OCE2kdZu+2I7s4jCga2lAPxCNBCEubnV7stt9K5apFogF11PRElhf9VGX aCuFgDYoGpYW79Dnc8SpaXCAVW9XrCAR2GO92rdL6oiBpPZ7FFH/xtADLrdmGzUqOm0d o0O1O/9eslEAK55s/dleJSGiHGvsMqoJiobH8JfOn+HBcaWBDrTklsmgtiDn8VgtaYk5 WF2JT/BPxl5d06PcT5ozrKRv2Tg+QTx1qvr/ZFVEMSkx8OBJPDMrZsbaxZbC4ACunke+ WKdTMfPc+t1M4lA1KVNNPZkhmJUnrP+257CdwU587GGiDqiw+NL9SSmeNvy0/tRuuPtT ZGzQ== X-Gm-Message-State: AOAM530w7TvRD6NgtbM1ADC/vSqa2JN2U+C0luIlK0A2YW3CCCPoGlEl spK2IMxqvpZFBB0JNHbVgdh3FmYTgpZyWw== X-Google-Smtp-Source: ABdhPJxl2zhjwT0+m/98ZMY2lackJtl8tfeqw/Ct5pbQHEfrOZscRWwlfTDP6y2amO/Ef3Bnk07ouA== X-Received: by 2002:a1c:7213:: with SMTP id n19mr17484023wmc.14.1608568174466; Mon, 21 Dec 2020 08:29:34 -0800 (PST) Received: from localhost.localdomain ([81.0.34.85]) by smtp.gmail.com with ESMTPSA id w18sm28523532wrn.2.2020.12.21.08.29.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 08:29:33 -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 v2 7/7] bisect--helper: retire `--check-and-set-terms` subcommand Date: Mon, 21 Dec 2020 17:27:43 +0100 Message-Id: <20201221162743.96056-8-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221162743.96056-1-mirucam@gmail.com> References: <20201221162743.96056-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 1a6c75183a..eb2a46a4b4 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}=]" @@ -1072,7 +1071,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, @@ -1087,8 +1085,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, @@ -1124,12 +1120,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"));