From patchwork Wed Feb 3 21:54:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065409 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 94A49C433E0 for ; Wed, 3 Feb 2021 21:56:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B9E864F6C for ; Wed, 3 Feb 2021 21:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232314AbhBCV4N (ORCPT ); Wed, 3 Feb 2021 16:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232256AbhBCV4H (ORCPT ); Wed, 3 Feb 2021 16:56:07 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E14C0613D6 for ; Wed, 3 Feb 2021 13:55:27 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id g10so1087680wrx.1 for ; Wed, 03 Feb 2021 13:55: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=DHUFSHVftxro75ZZkAF+vpT+wiuC6ZRoJswaXw+dD4E=; b=PXO+L+QxlEq3RNJ7RZFqu9MZmdTXbstjrI+8hzPu7MmZ2y25nPUAv4z0+7/0mu8dAB wgp4q/mayFIPpz+EH2WWIwGa6upPutXZA0VOwwMaeEOyJpKfBtASU5nH2dO86iqj35mU Lq32papOomAl847QaF2E7BotFTMmDvuIhjGY6aZO7CTYY7gf3Yh/L7IcDNQsK3eQxDct odAsR/HKetcOrxGOBj1lWEM6Z9FboKMG4djlAPQCmTTxMj6iyUoOApRpmVjZcWHANZNM gPznWaQHlDXB7CgegwsJcp6bC+qKTRBCQ+yJjePTiDbxdl5qWg5Es57zpQT0hK1uBHLU wzHw== 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=DHUFSHVftxro75ZZkAF+vpT+wiuC6ZRoJswaXw+dD4E=; b=b/tJGZ7btjmF7pQX8bmYpQXlCqWdxnKw2gIVjwp5HHHni3YWDr97mkredoYaLz1mQK ADUgS2BiHWaK5SgtMRfpTjczmnNtmkKxmJdI3QdpUJP7tN87GKpT66NAKtHdoh8jrCB7 n0hsu0JkEOlPq9bxXRaVxgY2rsmgCjlSjADN1MDVdHhrE3EFJVMDjc09KSx6fkuaySQD Wo3vp3KRDkdjccc26Wh4IF6nHDd2mzHC0IxRS/xyTaG3oC0A13n7e3wOZiL8xOa21BMD 7Liz8xKlPNS7Og9qgJImFTgImVtPAJ1l+B1f+tkBLEaT0FZPXgBKBf+W/qHNKskU6UaZ rWgg== X-Gm-Message-State: AOAM530MQ26gwSW2HH4nZ6sEK/zSdiQ26cFySN3lDItjuowQuDeVvPD2 8t/agMAFMOZ1fRcY3Lwipo7ZXN+0nK8= X-Google-Smtp-Source: ABdhPJxGqltUvlEiGtBpceNlHJnwPFqL6F2aQzl0ngfHM9/gF6dU1pdtFc+CLPw473YU/xsxvsuKMw== X-Received: by 2002:a5d:6a01:: with SMTP id m1mr5639524wru.318.1612389325901; Wed, 03 Feb 2021 13:55:25 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:25 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 1/7] bisect--helper: reimplement `bisect_log` shell function in C Date: Wed, 3 Feb 2021 22:54:32 +0100 Message-Id: <20210203215438.96760-2-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 Helped-by: Rafael Silva Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 27 ++++++++++++++++++++++++++- git-bisect.sh | 7 +------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 709eb713a3..ce11383125 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -904,6 +904,23 @@ 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; + const char* filename = git_path_bisect_log(); + + if (is_empty_or_missing_file(filename)) + return error(_("We are not bisecting.")); + + fd = open(filename, 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 +933,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 +956,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 +1020,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_state(&terms, argv, argc); break; + case BISECT_LOG: + if (argc) + return error(_("--bisect-log requires 0 arguments")); + res = bisect_log(); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 1f3f6e9fc5..05863cc142 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -169,11 +169,6 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 done } -bisect_log () { - test -s "$GIT_DIR/BISECT_LOG" || die "$(gettext "We are not bisecting.")" - cat "$GIT_DIR/BISECT_LOG" -} - get_terms () { if test -s "$GIT_DIR/BISECT_TERMS" then @@ -210,7 +205,7 @@ case "$#" in replay) bisect_replay "$@" ;; log) - bisect_log ;; + git bisect--helper --bisect-log || exit ;; run) bisect_run "$@" ;; terms) From patchwork Wed Feb 3 21:54:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065415 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 4A04AC4332D for ; Wed, 3 Feb 2021 21:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22A7F64E46 for ; Wed, 3 Feb 2021 21:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232336AbhBCV4U (ORCPT ); Wed, 3 Feb 2021 16:56:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbhBCV4J (ORCPT ); Wed, 3 Feb 2021 16:56:09 -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 011D1C0613ED for ; Wed, 3 Feb 2021 13:55:29 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id m13so993151wro.12 for ; Wed, 03 Feb 2021 13:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xA3oA/VTtEXoh6bkc+S+vnA5RbCq5EV/toYJkiSlJ1o=; b=QOcH1PNS8wCQKNL0xCDCT6+zmU6LGMQiexGyiir+tA68p3a48CMNlnEj6nAdgAJwA4 VAOM6dbSh+osccRpU4SODt3GyWsJgGzb9WJ65zy494YPaRZiaKcRhja4Bsfb7Wl6z/U0 ul0zDvMyISxKU3fSAPrRwoheepbugTrJw+yp45orK46IjkuhthorRuKGKU931V8fzhNn MbGCG/8V3ZtgpGKRZ4TuJcftIM7n729915OZ9fTVrLqMuvA1A86O9c8rEzXbFfzIl3u/ SimRK4fDpSM8SO1BWzgO6LTwXy2Q9zETEclMFCa5i9lj1Ysk6oE9N/EtmUmL4j/7lQuU sAFg== 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=xA3oA/VTtEXoh6bkc+S+vnA5RbCq5EV/toYJkiSlJ1o=; b=gb9WXfa9wy9VvQ87m/67KgQGD9UatQEH3zYuc9HK+rtjirnVYofYrtPbdGbZgPXNE4 IbUANhrnPT8yHbIUTO7ZZjVeQWCFL/m6vrwATIo4ZUudJ5eBtaSq9fqc3ycTtwRN/nC5 HZJUKBKVCn9Gc2jvZpdSeXKtKHrmlV4395O6WLDF+4xja2ZPd2hNlFSOdzXsVxqV0ntd Q2vd2z5N/pWhx8Or9l2QhyWUuT+lYZCKcjWtChTbHxvkDpOuSqhbV7tIJRjmd4VZqKQe r12gaA58a3/gO+StRYqo1X8DmvPxX2T1P4vZX6QmDJt/a0Waly+iKTdsaYDxQFjfpQOp H+Ug== X-Gm-Message-State: AOAM533PQsL3Kj/ACgW1olhLcGgoQ6yVYGEMwPz+Ccsebc0+G4Otu1lA 6BPvcBwYfQCOGUrnjVza2mNo+f5BR1U= X-Google-Smtp-Source: ABdhPJx9swelkM93jKiNk0Mt6GxOdXv6avlYqE2U0Ikl1QLFuThNs5LdWthXxMejSTgq4x7vKnggDw== X-Received: by 2002:adf:f9d0:: with SMTP id w16mr5777883wrr.137.1612389327640; Wed, 03 Feb 2021 13:55:27 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:26 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 2/7] bisect--helper: reimplement `bisect_replay` shell function in C Date: Wed, 3 Feb 2021 22:54:33 +0100 Message-Id: <20210203215438.96760-3-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 ce11383125..24489f4411 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 }; @@ -921,6 +922,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"); + char *word_end, *rev; + + if ((!skip_prefix(p, "git bisect", &p) && + !skip_prefix(p, "git-bisect", &p)) || !isspace(*p)) + return 0; + p += strspn(p, " \t"); + + word_end = (char *)p + strcspn(p, " \t"); + rev = word_end + strspn(word_end, " \t"); + *word_end = '\0'; /* NUL-terminate the word */ + + get_terms(terms); + if (check_and_set_terms(terms, p)) + return -1; + + if (!strcmp(p, "start")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(rev, &argv); + res = bisect_start(terms, argv.v, argv.nr); + strvec_clear(&argv); + return res; + } + + if (one_of(p, terms->term_good, + terms->term_bad, "skip", NULL)) + return bisect_write(p, rev, terms, 0); + + if (!strcmp(p, "terms")) { + struct strvec argv = STRVEC_INIT; + int res; + sq_dequote_to_strvec(rev, &argv); + res = bisect_terms(terms, argv.nr == 1 ? argv.v[0] : NULL); + strvec_clear(&argv); + return res; + } + error(_("'%s'?? what are you talking about?"), p); + + return -1; +} + +static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *filename) +{ + FILE *fp = NULL; + enum bisect_error res = BISECT_OK; + struct strbuf line = STRBUF_INIT; + + if (is_empty_or_missing_file(filename)) + return error(_("cannot read file '%s' for replaying"), filename); + + if (bisect_reset(NULL)) + return BISECT_FAILED; + + fp = fopen(filename, "r"); + if (!fp) + return BISECT_FAILED; + + while ((strbuf_getline(&line, fp) != EOF) && !res) + res = process_replay_line(terms, &line); + + strbuf_release(&line); + fclose(fp); + + if (res) + return BISECT_FAILED; + + return bisect_auto_next(terms, NULL); +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -934,7 +1007,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[] = { @@ -958,6 +1032,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() @@ -1025,6 +1101,12 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) return error(_("--bisect-log requires 0 arguments")); res = bisect_log(); break; + case BISECT_REPLAY: + if (argc != 1) + return error(_("no logfile given")); + set_terms(&terms, "bad", "good"); + res = bisect_replay(&terms, argv[0]); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 05863cc142..e834154e29 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -77,38 +77,6 @@ bisect_visualize() { eval '"$@"' --bisect -- $(cat "$GIT_DIR/BISECT_NAMES") } -bisect_replay () { - file="$1" - test "$#" -eq 1 || die "$(gettext "No logfile given")" - test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")" - git bisect--helper --bisect-reset || exit - oIFS="$IFS" IFS="$IFS$(printf '\015')" - while read git bisect command rev tail - do - test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue - if test "$git" = "git-bisect" - then - rev="$command" - command="$bisect" - fi - get_terms - git bisect--helper --check-and-set-terms "$command" "$TERM_GOOD" "$TERM_BAD" || exit - get_terms - case "$command" in - start) - eval "git bisect--helper --bisect-start $rev $tail" ;; - "$TERM_GOOD"|"$TERM_BAD"|skip) - git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;; - terms) - git bisect--helper --bisect-terms $rev || exit;; - *) - die "$(gettext "?? what are you talking about?")" ;; - esac - done <"$file" - IFS="$oIFS" - git bisect--helper --bisect-auto-next || exit -} - bisect_run () { git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit @@ -203,7 +171,7 @@ case "$#" in reset) git bisect--helper --bisect-reset "$@" ;; replay) - bisect_replay "$@" ;; + git bisect--helper --bisect-replay "$@" || exit;; log) git bisect--helper --bisect-log || exit ;; run) From patchwork Wed Feb 3 21:54:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065413 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 E6598C433E9 for ; Wed, 3 Feb 2021 21:56:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A213B64F6D for ; Wed, 3 Feb 2021 21:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbhBCV4V (ORCPT ); Wed, 3 Feb 2021 16:56:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232294AbhBCV4K (ORCPT ); Wed, 3 Feb 2021 16:56:10 -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 19DCEC061786 for ; Wed, 3 Feb 2021 13:55:30 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id q7so976183wre.13 for ; Wed, 03 Feb 2021 13:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vhtAgoXno4N6+SiJYt28nArGCglWhtCa5Chnj6tZBUg=; b=h/HX2Lk7Ql9Abk3uTUS+tR5rLnj3aBp9UThWQeBETAC2IDlGkZ+kfTXczIMmZdSTnm H8uarPau2M82pxefg1ofC4cwYyVONt57G649NA0O6GHn4kKZhWi4wv4jrwRv9+kGVACe AXGiyy36cekE9Wr/Fx3g3ecErYy0c2o+oovwr468cXTV5ef0lfCOv5BYXpKQeJR5ny1m hhjGs7v9yrkYK8uyeuC230mbrkiWj0XSzbrLG6355ZdAGtBxQK2epOzdWBjuFNZR5gg1 U6KmGfgszreRf5d6TFMUNa9yWX42BbHMX1A/pE6eygcy+tXYe46B/+txhIu+iu8sWjVH 9bAg== 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=vhtAgoXno4N6+SiJYt28nArGCglWhtCa5Chnj6tZBUg=; b=JGaHzwWoKJUD3YrDtK6GXcqNnXNLIRmc8f7tHN2j2yDED7+1ypgd2iQPpI8Pq31ys2 1Cp8NQ0IIOrTIMb+21kZ8KTeTQopaaM+gPo2K5qVN0zcWg4d0g7mids49omGD++6lcB/ hGzVVWR/xOWAtE4OjkgkyWAaIl3MJd++nfjyAk2brnfygPjVU/nd3NJaq4C2af00nDz/ 2E4wf/TsqP+aPxc8y5BgQGUzVYoy7sADqmi9KibkBUrbmGbwojd8umdV/54r3olrERAN lcplP/WfwMwkL8XIRkra07ZTzzKiGwoFkMgnlTiR+vl+dRGvvo/GYlnX7dlwBxSZt8Ck uy/A== X-Gm-Message-State: AOAM530mf2Njr/RbZgyD7BNyBsAFkmFhpwreehbQjKmNXJhjhGFmlQe9 k1U5+RlxSL/uaiosH7HXfqwcgOvzy0o= X-Google-Smtp-Source: ABdhPJyO8pbCCtRHHDYZT/wqUZf31+mxEprQDZMV6Nmz5NOfaM284Z+U5w6WAD16JsB2iYhYxICUSQ== X-Received: by 2002:a5d:414c:: with SMTP id c12mr5917947wrq.251.1612389328808; Wed, 03 Feb 2021 13:55:28 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:28 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 3/7] bisect--helper: retire `--bisect-write` subcommand Date: Wed, 3 Feb 2021 22:54:34 +0100 Message-Id: <20210203215438.96760-4-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 24489f4411..36b50e3aa8 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]"), @@ -998,7 +997,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, @@ -1014,8 +1012,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, @@ -1052,12 +1048,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) return error(_("--check-and-set-terms requires 3 arguments")); From patchwork Wed Feb 3 21:54:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065411 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 0D316C43381 for ; Wed, 3 Feb 2021 21:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2E7064F5F for ; Wed, 3 Feb 2021 21:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbhBCV4W (ORCPT ); Wed, 3 Feb 2021 16:56:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbhBCV4L (ORCPT ); Wed, 3 Feb 2021 16:56:11 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE66BC061788 for ; Wed, 3 Feb 2021 13:55:30 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id 7so1097612wrz.0 for ; Wed, 03 Feb 2021 13:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LmEPKW5pzcRFq8NxXw8POw9K1zv72VmN32IOXZFvpd8=; b=NhdVr+BKCQwRGLw8I9Hvj+ocDBedr/ieMxB+LOkQScWRxRQKrcK9CZyR2iG1CKmyLH 2KfFcrYvrnHvUlh3w33E5jCvOFLjVEU6Qw9IOK68uFcB4HzCGN+Fu4SRxGHQE0ORh5/E 3dzaKVlJKu0RChBgWEpEwKztchyRjLbIPK199Jiv6UOCxoxqk806/0RF43szL1bpK3Ml Fz4J2BqVZZQJAy2xEx2laEMz+rOvOCYYUjnvs//ZEzcVAQLRQPJnZy7qmZBExjQCDt9q hKYY/OpVhVbNrJQvzFDLFDN6CGgYlGelcKY1QznGbnjW/3GsrroBZQyBNBUPeB6sLwnS plTg== 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=LmEPKW5pzcRFq8NxXw8POw9K1zv72VmN32IOXZFvpd8=; b=tAIWg8SkYiFAxjxb+KC1Ze/nVTk92gQVThQR39J9nkn44LWikfL0CcC3C2ghxs9YJJ HsF09kVsIXI5AJHpTTH7GxV4N4ef86MWu7Ys2umSbuj9NgBaYpu2OInbr5ofhQ7gWCWj xD6M3eHovTa0znLrlM5OVtipCS8BlEVsW6cts/OKNhKReE4SuD1Dci314cNMBWKGRNuq Z+C2o+3HzRTzL+C1PkXq4p6oxkPGxsN6D6ZMyR5blgIpHDjmmUof1VPzj5+eCyh4HvKL bu2JLdXRLOfOOnh15JV5z6DQOQ403P+lClZGZjEsZ7vYJjcFqiivTAhse1rOofoV/gAZ tuTA== X-Gm-Message-State: AOAM530GcbvBrTNdhHW1lFkIHtrrEFIk88+kqoyVh9gTKZLV5tLKRDQ4 Ix1Ssr3uaxSbiWdSuOwWgULwE31mCMw= X-Google-Smtp-Source: ABdhPJzalPUbQoCCFljGosPzs/OIoyinjQsky3yKVnvYziyaZGaYPyygIWWER9poVk9pITs7+GrMJA== X-Received: by 2002:adf:ee43:: with SMTP id w3mr6068329wro.200.1612389329712; Wed, 03 Feb 2021 13:55:29 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:29 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Christian Couder , Miriam Rubio Subject: [PATCH v5 4/7] bisect--helper: use `res` instead of return in BISECT_RESET case option Date: Wed, 3 Feb 2021 22:54:35 +0100 Message-Id: <20210203215438.96760-5-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 36b50e3aa8..fd018ddda5 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -1047,7 +1047,8 @@ 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) return error(_("--check-and-set-terms requires 3 arguments")); From patchwork Wed Feb 3 21:54:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065417 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 9E89FC433E0 for ; Wed, 3 Feb 2021 21:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5074064F5F for ; Wed, 3 Feb 2021 21:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbhBCV4v (ORCPT ); Wed, 3 Feb 2021 16:56:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232366AbhBCV4s (ORCPT ); Wed, 3 Feb 2021 16:56:48 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3834C06178A for ; Wed, 3 Feb 2021 13:55:31 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id c12so1020755wrc.7 for ; Wed, 03 Feb 2021 13:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=spbB+9a/qGy/GHfu1eZe/L4LU9K7gSjpfEPxZ03UfEo=; b=gCbQaWwJj6daR1xrlr/RgV15BDAwKkTQIroiG32YzI+9jWSv7Iq0j1ZzidFQvLQNyP R68GT8+a4t9gtkC1UnPChL7sAWiGe/wIawADqYuMsdBvjRrRlz2N/+OAsP/fjsZV66iv VuawADeM2fibeuu0WhLyoLjFlJ3HwbTaBirgpvclG1jJoRsI9BEFZV3A0hD96srjfN02 UF1/Heio47cJ54C/tUxhtONINWVgBiYsAXo3w6ctE964K9NLPohUo4RzmJwPwV0vR4Ta WBox4rL/+YdDQLoBVZCS3c7xKoQRLe7pKyh1o3Lya8MgDm1xJ0ZLcjjV6X150iVesA7P i8hA== 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=spbB+9a/qGy/GHfu1eZe/L4LU9K7gSjpfEPxZ03UfEo=; b=piEYUgYlUBW/dmrjfK5O2Qs3BE/RyhmuAefL93ATJd5XMMQmd3zOqhM5WAx2ckFXUD Oh9/YhLsUvs0d+37P9W577o8ewbMNeOUWxdvLzKfOUvjOCi8QZDuLocd3nNMd7MuPaoS KOGAqLBOHV7Cq078/tDU/x5UJkc+hZigo+tvp6+f1LTtxslZA9kOLb7fMDXW9dG/xw02 JnjKt/wU11W7caDgNADT34SI9e85kdr4hu7HNCr6rr46y45Zi7hoxMCl1zb1nfx9LiNq +CEnuySKfRecGp5KiUUQt3MnEhEcwgtZ31cZJPmEL24SHRyDi/pyL+G3wH7BXn0i0fYk OWZA== X-Gm-Message-State: AOAM533kjKzU4JcZmNlLru7AE+u/FJJe0qjLkAHnnx0tJwKLCZli/4U6 lXIQr6+R0OZX7isiW5xWNfxDchwwvo8= X-Google-Smtp-Source: ABdhPJwvXZCgcIOv4Rh05ht0idyefa38awXpREQPoihNLUGhtjZt3AwXvwqGcXX7r0o00yqhRsHgNw== X-Received: by 2002:adf:d20c:: with SMTP id j12mr5765988wrh.407.1612389330634; Wed, 03 Feb 2021 13:55:30 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:30 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 5/7] bisect--helper: retire `--bisect-auto-next` subcommand Date: Wed, 3 Feb 2021 22:54:36 +0100 Message-Id: <20210203215438.96760-6-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 fd018ddda5..31eba522ff 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 "), @@ -1003,7 +1002,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 @@ -1022,8 +1020,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, @@ -1076,12 +1072,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 Wed Feb 3 21:54:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065455 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 E1BA8C433DB for ; Wed, 3 Feb 2021 21:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AD7964F6B for ; Wed, 3 Feb 2021 21:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbhBCV4y (ORCPT ); Wed, 3 Feb 2021 16:56:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbhBCV4s (ORCPT ); Wed, 3 Feb 2021 16:56:48 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2556C06178B for ; Wed, 3 Feb 2021 13:55:32 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id f16so1217337wmq.5 for ; Wed, 03 Feb 2021 13:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1I9MuZk5+Y9ELPMFnogL7a7Kp0ubTDgTkirTInm3rRI=; b=neEOt168rcL9GoZSFr9+q2ox8yV2lFU1T7NRdF2PhXc7a+xOLn5pgPX4lAdV7Ber7L 3P5/5xnE2IQfAWSWd+AkXXShfCgpekqwTVZU6Bwl1H8nkB2FOTlBd0qbVyOBz+ezY2Wo CoDifFe4vWVSBCkMkyhKSwKKtrugOiPOMM4LwvbrQW48+jdLSdJFHHLDc43V1DdzufwM d3Rwx8NRgo65xmlvAqv1f2H3u0CSLkpF0FYDWSFFLWGny1nCIBZ+U5U/0k203qDrel5v pyaaK+TQ4WjFpVxA4q/IsDcAVlUBgmkrA1/Y3Hs5XuaPYPhNO9Hpz4JO7iQ6U7/3bj3/ Dp6g== 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=1I9MuZk5+Y9ELPMFnogL7a7Kp0ubTDgTkirTInm3rRI=; b=TU4F38FKafXTXn84cPyn/hwtbHjDrWu+0R98X99ZDh6Vy7zX6/EWb0UVuLQtRywiCX 4IiJf4YgCctmTOhcvtDXZ5GpmWxnb9YxOC0EqMNqidoOkvCg9AKMiHnGBbQnzpv8Y0iy CtLqrdIvZTIUwyCVY3Y0VaxokUSYO9+2M58xtB3MPdnFm2/0+50avb8YNl9zjub+w2XG FLHWIbBmG139M9mLVsdfcDQx0YYfGuB82AbZgBy2B+7NWt0UBem4PyrXzN9omlKac6Rg ybqddkc5gqAsoEzqIzvNxKUzlqoX7U8m30hBi3ED4XYSp1xXrTxXy5PfOG1Cyq56fEG9 eIvg== X-Gm-Message-State: AOAM530PjjP8FPIx2syGmYCBGkovpryjLR20LdVacFSz8EwbAM8RqPEB Km4YjoQnJ4V49A96BfCnGg0Ojk039DQ= X-Google-Smtp-Source: ABdhPJy7xeGVZ7n4RvIIEekZ3RjmJg6qZ1wZz2qonIE69J7jZfKGZZyUIcpRPi7aXKMtlcK5fzhZcA== X-Received: by 2002:a05:600c:3504:: with SMTP id h4mr4712173wmq.168.1612389331571; Wed, 03 Feb 2021 13:55:31 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:31 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 6/7] bisect--helper: reimplement `bisect_skip` shell function in C Date: Wed, 3 Feb 2021 22:54:37 +0100 Message-Id: <20210203215438.96760-7-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 31eba522ff..7ad9b4d55b 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 }; @@ -992,6 +993,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 { @@ -1004,7 +1040,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[] = { @@ -1026,6 +1063,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() @@ -1088,6 +1127,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_replay(&terms, argv[0]); break; + case BISECT_SKIP: + set_terms(&terms, "bad", "good"); + res = bisect_skip(&terms, argv, argc); + break; default: BUG("unknown subcommand %d", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index e834154e29..6a7afaea8d 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -39,21 +39,6 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" TERM_BAD=bad TERM_GOOD=good -bisect_skip() { - all='' - for arg in "$@" - do - case "$arg" in - *..*) - revs=$(git rev-list "$arg") || die "$(eval_gettext "Bad rev input: \$arg")" ;; - *) - revs=$(git rev-parse --sq-quote "$arg") ;; - esac - all="$all $revs" - done - eval git bisect--helper --bisect-state 'skip' $all -} - bisect_visualize() { git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit @@ -162,7 +147,7 @@ case "$#" in bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") git bisect--helper --bisect-state "$cmd" "$@" ;; skip) - bisect_skip "$@" ;; + git bisect--helper --bisect-skip "$@" || exit;; next) # Not sure we want "next" at the UI level anymore. git bisect--helper --bisect-next "$@" || exit ;; From patchwork Wed Feb 3 21:54:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 12065457 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 5AE4CC433DB for ; Wed, 3 Feb 2021 21:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2052B64F6C for ; Wed, 3 Feb 2021 21:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232411AbhBCV44 (ORCPT ); Wed, 3 Feb 2021 16:56:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232376AbhBCV4t (ORCPT ); Wed, 3 Feb 2021 16:56:49 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50FDC06178C for ; Wed, 3 Feb 2021 13:55:33 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id b3so1049377wrj.5 for ; Wed, 03 Feb 2021 13:55:33 -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=mkYGtGgbgi7zNnwSPavbqMHadABSk3fc72upqSEr/CA=; b=KJdgQRQ4Cdwfs3l6Pk8BDMB0GXq7Vyr3zA/nwxNY0fA7yBHrBoRwa0KgKbuW29d1MW or161KEdc9DnVCNyxcTT5vfOzxh26YPcd9Rj8GBj+7kLVseUKly9Y4+97APBs/D/6ewT JfSlm5eSsMatTceXUC3xzB5tHu6bFXOycG6LvtpegSKppvjzVyLYVoJEjdciVRhm0Po4 kaU+2dz/cBbcoy2yUOfYOy/DW+Sg76d5pNVui1sXOfdjBKj9jyo/doi0tn1jjHHSPhU2 sqC4/YjjitDXoR/Oo9VyfJEtPXYA22Hb/L0nQikNttrBZPZ3sPdYv5QFUVg2nVh/K6sa H6Dg== 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=mkYGtGgbgi7zNnwSPavbqMHadABSk3fc72upqSEr/CA=; b=t5A5gWybUR7AFTMwXZ/sSdiS3JgUozPXilAR8UtOl2c3Q6MdU113A3sueE2o+zEklK YQTbEsSEA7s/+/LjI8UYqY7C0/3NyT0+TSq6IuE77RN5P46Tr1JfHX7kbaCsyXMd0avM eMvs1uiyC/H43OqroXEs4Us5GDd0mqkLxHF/OwPaIARpMjl/H8sxXrcD2BNcUHY4lN0Y 0gk/PD3w/uIgxQc+9AAEdlQVuixr1ejSu8D/t1e+UZvbpBpXodN0sc8LwcwF4qX1xZ9u 3S4uUOyAhBIWQTk/saOS/ueKILmMCUkyn7xr/TuT3SRXo5WlCkEVezaKePVTIvd+h6nP QFug== X-Gm-Message-State: AOAM531MxLxU38R41UVmIx8rMjPLn6ByxCL/vq4kp8mOvpOmCRiScu7m zySPGZ/7N/kCJX7tFoNqApE0J6mRVdE= X-Google-Smtp-Source: ABdhPJyTYDxS7eOeOUUQL8672Zcvz5NLgai641LqFUtzPzP7JUyPEmsGxeDxO8GCIfL1B3jKvsJyeA== X-Received: by 2002:adf:9261:: with SMTP id 88mr5678139wrj.227.1612389332501; Wed, 03 Feb 2021 13:55:32 -0800 (PST) Received: from localhost.localdomain ([81.0.37.148]) by smtp.gmail.com with ESMTPSA id 143sm2609531wmb.47.2021.02.03.13.55.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2021 13:55:32 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: rafaeloliveira.cs@gmail.com, Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v5 7/7] bisect--helper: retire `--check-and-set-terms` subcommand Date: Wed, 3 Feb 2021 22:54:38 +0100 Message-Id: <20210203215438.96760-8-mirucam@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210203215438.96760-1-mirucam@gmail.com> References: <20210203215438.96760-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 7ad9b4d55b..d69e13335d 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}=]" @@ -1032,7 +1031,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, @@ -1047,8 +1045,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, @@ -1084,12 +1080,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"));