From patchwork Wed Feb 26 10:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CB5614E3 for ; Wed, 26 Feb 2020 10:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C17F24670 for ; Wed, 26 Feb 2020 10:16:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZFvZx5x8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbgBZKQK (ORCPT ); Wed, 26 Feb 2020 05:16:10 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37620 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbgBZKQK (ORCPT ); Wed, 26 Feb 2020 05:16:10 -0500 Received: by mail-wm1-f66.google.com with SMTP id a141so1585365wme.2 for ; Wed, 26 Feb 2020 02:16:08 -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=UIytmC7GTXrVPhI65c5jfqi3j18nq3mt6BWslGwoi34=; b=ZFvZx5x8fpcd3kJOf7PNUSfiCCfE5WRTLx7Q3CjqpdQwlWX7mca5yxut2hAmyY2ZMj +4nfSMSjuaXoJbok5f10Y5YwG0U3cnOa0t16XO0ClDlihTcFD7f31kc3Z1PmHneZyciB 1Db6nB4mlU1mVUz1f3wFoRxddcxp7tX9a/AL5LaIvGqpBgzHFFJrNLdOL6oElIdietX4 tqfc18Z5eaLWQlZwsyQjuXJgVrOuPE5W3+vdXiIZpLi3HlsVf0rCNlkYxuE2FG+YpNtk 2g2lMtHnY6XCzAo/+lc+dGUdHsJ3Ra+qjD/iDzdh79HJufU/obLgo7OPUOBqWmuBEsCp 7zqQ== 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=UIytmC7GTXrVPhI65c5jfqi3j18nq3mt6BWslGwoi34=; b=lp50yt7FXpgttbYcsnPduzkOgi6bFP1au/ra2E8c3kKLVPnrxfneJ2X/PaeYArQkFi HF53RaGM04qrJGaylIpREuCSQx6zjD+MXi3ij0n0H5UsMh/gZI9I0Lnv2aC0EyCDh4et 8zN1LKEBkE+IcXNkp/3KNXZzBSGcznfd15I5z4DxhbbV9fUpjx7AipUpMjFFcoh83Ubk sXYy9KFhfAxy9xqp/YjmVT/Y3/fZUx1wsOA9tPXVhNwGfx3CJ+Q7Q6wXqYJZQAP5Kuwi Jyz5dfycYsNtGxZ01ASe7ERPxxnmjuWs1H+x3X2tPRSqyIEBvY+dFmjg4j2Z4DFVqY1Q TaZQ== X-Gm-Message-State: APjAAAUtOm4jxpA0Rq5f8s6knaf/AJ3fLZLOtihDP8mIKgkW+tjk1fnD i3cZApY2ex8qYD7EzsPPsTNLHpiP X-Google-Smtp-Source: APXvYqxtTlbwGmdLG8PM5YCAV+JEcowWEwACcD+HLEEgtk6Qtrh1WjRgNlW/v2lAO6vNuJugebjTIw== X-Received: by 2002:a7b:c119:: with SMTP id w25mr4760934wmi.116.1582712166861; Wed, 26 Feb 2020 02:16:06 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:06 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH 01/10] bisect--helper: introduce new `write_in_file()` function Date: Wed, 26 Feb 2020 11:14:20 +0100 Message-Id: <20200226101429.81327-2-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Let's refactor code adding a new `write_in_file()` function that opens a file for writing a message and closes it. This removes some duplicated code and makes the code simpler, clearer and easier to understand. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index c1c40b516d..ee1be630da 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -74,6 +74,19 @@ static int one_of(const char *term, ...) return res; } +static int write_in_file(const char *filepath, const char *content, int append) +{ + FILE *fp = NULL; + const char *mode = append ? "a" : "w"; + + fp = fopen(filepath, mode); + if (!fp) + return error_errno(_("could not open the file '%s'"), filepath); + if (!fprintf(fp, "%s\n", content)) + return error_errno(_("could not write in file '%s'"), filepath); + return fclose(fp); +} + static int check_term_format(const char *term, const char *orig_term) { int res; @@ -104,7 +117,7 @@ static int check_term_format(const char *term, const char *orig_term) static int write_terms(const char *bad, const char *good) { - FILE *fp = NULL; + char *content = xstrfmt("%s\n%s", bad, good); int res; if (!strcmp(bad, good)) @@ -113,12 +126,9 @@ static int write_terms(const char *bad, const char *good) if (check_term_format(bad, "bad") || check_term_format(good, "good")) return -1; - fp = fopen(git_path_bisect_terms(), "w"); - if (!fp) - return error_errno(_("could not open the file BISECT_TERMS")); + res = write_in_file(git_path_bisect_terms(), content, 0); + free(content); - res = fprintf(fp, "%s\n%s\n", bad, good); - res |= fclose(fp); return (res < 0) ? -1 : 0; } From patchwork Wed Feb 26 10:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405865 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7F8414E3 for ; Wed, 26 Feb 2020 10:16:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFDDC24656 for ; Wed, 26 Feb 2020 10:16:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iinAQONa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727607AbgBZKQN (ORCPT ); Wed, 26 Feb 2020 05:16:13 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:52826 "EHLO mail-wm1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbgBZKQM (ORCPT ); Wed, 26 Feb 2020 05:16:12 -0500 Received: by mail-wm1-f52.google.com with SMTP id p9so2319362wmc.2 for ; Wed, 26 Feb 2020 02:16: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=BBZ6G+fUiInsLyBUGxOxUOQrqvvTCxZ1x7uwHVKAz8U=; b=iinAQONaUFhdx36IYrTF31Wd9EayFT7POcDyGF0XRq8q/l+9KeJOJWpfECl2/CDj8t GTKpIpGYWrEeNKBIVdSBmu7ITeB3gR+ClrhNlQiAYgD5p9rmjORXAu9OC65R2i4CzsVW RH0S4Rr9ZaxxUK3BXolUxZsYNal/S4n9dNpOr6/vq93IXWaMhAgezYrj7fMVmbb+PTFw lUxOlAnw8A3cWoVOfg9EGc1QEjDJPCJ0Z1pRqVgWVpyANI6K3JVNagwsV3KHpJhyzF2J MwI54kzlgw+++jICMCDTqpnEFL0QEUGyZSdTOq1It3z2n3pQqWmzxdKkY5Zhu0CGNgwh k13g== 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=BBZ6G+fUiInsLyBUGxOxUOQrqvvTCxZ1x7uwHVKAz8U=; b=f85KHMnWloTWNCwoV8TJYiJDwQYfXpwg50wCwTo7avVl+4VgABYT0JAHiUdAzX9ybE 4VMFpLMHL2JsyPAun39q0S+JF3DkgIHyTH2LcRdQxiAguRUfaU6GXxv4F7+a2Fc5KiAO K/m7CS4mxH753DAsC0X2FrFeDNLqGPfa8h6sUE3tuUqBycK800IDBW8emx5SiLViV862 tb3oJIhF1W8b1SNygW1mMdFIitdZCE/zi6vqq9PYOW6qIrKBxlSTMd9xOYXSUoOEYgL+ DLpwr3SIZpS5OHPBArHFeldVX4ZMJFO9D+YwnVE/1KV2/RR79xafI0qEIUVKM5fwG756 Ef8Q== X-Gm-Message-State: APjAAAV1SCK7UmUWAANrJChM6Pkalcqh2Z9qSxZZdPZruglU+8Pw65oD U4BIH8uaRGknRmuf3Gze3MbYpo5MnbA= X-Google-Smtp-Source: APXvYqx+NPUZw4TPLUWINC0QxnbrDgSKLhQR7j9+k0Wz/BKBXGikxRpyDzXhC3sVgZZIvv0QzSkkQA== X-Received: by 2002:a7b:cf08:: with SMTP id l8mr4522611wmg.169.1582712168308; Wed, 26 Feb 2020 02:16:08 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:07 -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 02/10] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C Date: Wed, 26 Feb 2020 11:14:21 +0100 Message-Id: <20200226101429.81327-3-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_next()` and the `bisect_auto_next()` shell functions in C and add the subcommands to `git bisect--helper` to call them from git-bisect.sh . Using `--bisect-next` and `--bisect-auto-start` subcommands is a temporary measure to port shell function to C so as to use the existing test suite. As more functions are ported, `--bisect-auto-start` subcommand will be retired and will be called by some other methods. 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 --- bisect.c | 11 +++ builtin/bisect--helper.c | 172 ++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 47 +---------- 3 files changed, 186 insertions(+), 44 deletions(-) diff --git a/bisect.c b/bisect.c index 9154f810f7..a50278ea7e 100644 --- a/bisect.c +++ b/bisect.c @@ -635,6 +635,11 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs, struct argv_array rev_argv = ARGV_ARRAY_INIT; int i; + /* + * `revs` could has been used before. + * Thus we first need to reset it. + */ + reset_revision_walk(); repo_init_revisions(r, revs, prefix); revs->abbrev = 0; revs->commit_format = CMIT_FMT_UNSPECIFIED; @@ -980,6 +985,12 @@ void read_bisect_terms(const char **read_bad, const char **read_good) * the bisection process finished successfully. * In this case the calling function or command should not turn a * BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND return code into an error or a non zero exit code. + * + * Checking BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND + * in bisect_helper::bisect_next() and only transforming it to 0 at + * the end of bisect_helper::cmd_bisect__helper() helps bypassing + * all the code related to finding a commit to test. + * * If no_checkout is non-zero, the bisection process does not * checkout the trial commit but instead simply updates BISECT_HEAD. */ diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index ee1be630da..c82ffe9c1c 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -8,6 +8,7 @@ #include "run-command.h" #include "prompt.h" #include "quote.h" +#include "revision.h" static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") @@ -29,6 +30,8 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"), N_("git bisect--helper --bisect-start [--term-{old,good}= --term-{new,bad}=]" "[--no-checkout] [ [...]] [--] [...]"), + N_("git bisect--helper --bisect-next"), + N_("git bisect--helper --bisect-auto-next"), NULL }; @@ -431,6 +434,155 @@ static int bisect_append_log_quoted(const char **argv) return res; } +static int register_good_ref(const char *refname, + const struct object_id *oid, int flags, + void *cb_data) +{ + struct string_list *good_refs = cb_data; + + string_list_append(good_refs, oid_to_hex(oid)); + return 0; +} + +static void prepare_rev_argv(struct bisect_terms *terms, struct argv_array *rev_argv) +{ + struct string_list good_revs = STRING_LIST_INIT_DUP; + char *term_good = xstrfmt("%s-*", terms->term_good); + + for_each_glob_ref_in(register_good_ref, term_good, + "refs/bisect/", &good_revs); + + argv_array_pushl(rev_argv, "skipped_commits", "refs/bisect/bad", "--not", NULL); + for (int i = 0; i < good_revs.nr; i++) + argv_array_push(rev_argv, good_revs.items[i].string); + + string_list_clear(&good_revs, 0); + free(term_good); +} + +static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs) +{ + int res = 0; + struct argv_array rev_argv = ARGV_ARRAY_INIT; + + prepare_rev_argv(terms, &rev_argv); + + /* + * It is important to reset the flags used by revision walks + * as the previous call to bisect_next_all() in turn + * setups a revision walk. + */ + reset_revision_walk(); + init_revisions(revs, NULL); + rev_argv.argc = setup_revisions(rev_argv.argc, rev_argv.argv, revs, NULL); + if (prepare_revision_walk(revs)) + res = error(_("revision walk setup failed\n")); + + argv_array_clear(&rev_argv); + return res; +} + +static int process_skipped_commits(FILE *fp, struct bisect_terms *terms, struct rev_info *revs) +{ + struct commit *commit; + struct pretty_print_context pp = {0}; + + if (fprintf(fp, "# only skipped commits left to test\n") < 1) + return -1; + + while ((commit = get_revision(revs)) != NULL) { + struct strbuf commit_name = STRBUF_INIT; + format_commit_message(commit, "%s", + &commit_name, &pp); + fprintf(fp, "# possible first %s commit: [%s] %s\n", + terms->term_bad, oid_to_hex(&commit->object.oid), + commit_name.buf); + strbuf_release(&commit_name); + clear_commit_marks(commit, ALL_REV_FLAGS); + } + + return 0; +} + +static int bisect_skipped_commits(struct bisect_terms *terms) +{ + int res = 0; + FILE *fp = NULL; + struct rev_info revs; + + fp = fopen(git_path_bisect_log(), "a"); + if (!fp) + return error_errno(_("could not open '%s' for appending"), + git_path_bisect_log()); + + res = prepare_revs(terms, &revs); + + if (!res) + res = process_skipped_commits(fp, terms, &revs); + + fclose(fp); + return res; +} + +static int bisect_successful(struct bisect_terms *terms) +{ + struct object_id oid; + struct commit *commit; + struct pretty_print_context pp = {0}; + struct strbuf commit_name = STRBUF_INIT; + char *bad_ref = xstrfmt("refs/bisect/%s", + terms->term_bad); + char *content; + int res; + + read_ref(bad_ref, &oid); + printf("%s\n", bad_ref); + commit = lookup_commit_reference(the_repository, &oid); + format_commit_message(commit, "%s", &commit_name, &pp); + + content = xstrfmt("# first %s commit: [%s] %s", + terms->term_bad, oid_to_hex(&oid), + commit_name.buf); + + res = write_in_file(git_path_bisect_log(), content, 1); + + strbuf_release(&commit_name); + free(bad_ref); + free(content); + return res; +} + +static enum bisect_error bisect_next(struct bisect_terms *terms, const char *prefix) +{ + int no_checkout; + enum bisect_error res; + + if (bisect_next_check(terms, terms->term_good)) + return BISECT_FAILED; + + no_checkout = !is_empty_or_missing_file(git_path_bisect_head()); + + /* Perform all bisection computation, display and checkout */ + res = bisect_next_all(the_repository, prefix, no_checkout); + + if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) { + res = bisect_successful(terms); + return res ? res : BISECT_INTERNAL_SUCCESS_MERGE_BASE; + } else if (res == BISECT_ONLY_SKIPPED_LEFT) { + res = bisect_skipped_commits(terms); + return res ? res : BISECT_ONLY_SKIPPED_LEFT; + } + return res; +} + +static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char *prefix) +{ + if (bisect_next_check(terms, NULL)) + return BISECT_OK; + + return bisect_next(terms, prefix); +} + static int bisect_start(struct bisect_terms *terms, int no_checkout, const char **argv, int argc) { @@ -635,7 +787,9 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, BISECT_TERMS, - BISECT_START + BISECT_START, + BISECT_NEXT, + BISECT_AUTO_NEXT, } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -659,6 +813,10 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("print out the bisect terms"), BISECT_TERMS), OPT_CMDMODE(0, "bisect-start", &cmdmode, 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_BOOL(0, "no-checkout", &no_checkout, N_("update BISECT_HEAD instead of checking out the current commit")), OPT_BOOL(0, "no-log", &nolog, @@ -720,6 +878,18 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_start(&terms, no_checkout, argv, argc); break; + case BISECT_NEXT: + if (argc) + return error(_("--bisect-next requires 0 arguments")); + 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; default: return error("BUG: unknown subcommand '%d'", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index efee12b8b1..e03f210d55 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -86,8 +86,7 @@ bisect_start() { # # Check if we can proceed to the next bisect state. # - get_terms - bisect_auto_next + git bisect--helper --bisect-auto-next || exit trap '-' 0 } @@ -140,45 +139,7 @@ bisect_state() { *) usage ;; esac - bisect_auto_next -} - -bisect_auto_next() { - git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD && bisect_next || : -} - -bisect_next() { - case "$#" in 0) ;; *) usage ;; esac - bisect_autostart - git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit - - # Perform all bisection computation, display and checkout - git bisect--helper --next-all $(test -f "$GIT_DIR/BISECT_HEAD" && echo --no-checkout) - res=$? - - # Check if we should exit because bisection is finished - if test $res -eq 10 - then - bad_rev=$(git show-ref --hash --verify refs/bisect/$TERM_BAD) - bad_commit=$(git show-branch $bad_rev) - echo "# first $TERM_BAD commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG" - exit 0 - elif test $res -eq 2 - then - echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG" - good_revs=$(git for-each-ref --format="%(objectname)" "refs/bisect/$TERM_GOOD-*") - for skipped in $(git rev-list refs/bisect/$TERM_BAD --not $good_revs) - do - skipped_commit=$(git show-branch $skipped) - echo "# possible first $TERM_BAD commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG" - done - exit $res - fi - - # Check for an error in the bisection process - test $res -ne 0 && exit $res - - return 0 + git bisect--helper --bisect-auto-next } bisect_visualize() { @@ -232,7 +193,7 @@ bisect_replay () { die "$(gettext "?? what are you talking about?")" ;; esac done <"$file" - bisect_auto_next + git bisect--helper --bisect-auto-next } bisect_run () { @@ -329,7 +290,7 @@ case "$#" in bisect_skip "$@" ;; next) # Not sure we want "next" at the UI level anymore. - bisect_next "$@" ;; + git bisect--helper --bisect-next "$@" || exit ;; visualize|view) bisect_visualize "$@" ;; reset) From patchwork Wed Feb 26 10:14:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405863 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 278AF14D5 for ; Wed, 26 Feb 2020 10:16:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F302224656 for ; Wed, 26 Feb 2020 10:16:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lzP2HidS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727590AbgBZKQN (ORCPT ); Wed, 26 Feb 2020 05:16:13 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37605 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbgBZKQM (ORCPT ); Wed, 26 Feb 2020 05:16:12 -0500 Received: by mail-wr1-f68.google.com with SMTP id l5so2250179wrx.4 for ; Wed, 26 Feb 2020 02:16:11 -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=Gnnykk1BeT9/Xn/4TALX6BuNNkhGtAFpMtlkyiqz9X0=; b=lzP2HidSZzZKxnptM5B7rhArkCKs+11tnOJgl9fbcvRIzWNp6uaa5CpGKmerUhlu6N 70JX+hq7/ERnXhNyBw9XhjGVFx0r2mGBqKSGRkxcav1Wc5es2wLcCzHe9+UfQQtuE+PW cRsDRs7th/SPdT/TgisfEN2eZoNWPhlLsG5a3xDoQqN66sG2mU5pMWq1bYk2cBa6Wmf/ 3dZJh6Oi+ekzY+v67SudGKn31oy79TQ2ZpUCsSYOVmUDZAacKTB89YEtlAzUAiyHLOBd QvA+4UPL+dcS3MaC2rBRAZ1mz8PvvofbmXNRXkcnSJQ4oAJHWOn7nUKVYQX8FyNoa7cs ZZkg== 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=Gnnykk1BeT9/Xn/4TALX6BuNNkhGtAFpMtlkyiqz9X0=; b=sPkIz+4oj6vsxWLvJXe3q4pYzF6aSGphhrfzQkOQBDUqCmeJ4qi32CTFql9Gr8FxvL sofN4LXXQ0U2loVQeLnskB/9rxaXUb12Wuqm+1AKqRw0yxFLM0/WXIyZOBczlb1UKT84 D1dJpkRmKRAVvaqhoHz2hb5kkZcACMHBMhsord5IQfwSA3QkbiLVmzVWgDQbu8M8BZf5 8tngBcT6BrTBH+vZwk1RNA+okkzhJioVc/RB0EYznEPLHvVIXjXL37AeyKfn8zvdgaj/ lxJ3MOxVBT7kDvKOpwZ3mKttjC8bcffiLf57I1Ndm0XSf1dz5qloOuZGB7Mei/8dF1id S0Pg== X-Gm-Message-State: APjAAAU9eb0KxmSf9e4w5F50+3nESBnwrUsjCpEeMJi92LGS+bxbax2r OhwlQ//Uk4InYH6yfPC16g6DCW71 X-Google-Smtp-Source: APXvYqwReUq8rjT6ZK7YSM5+U/6E6oiqIMUEiKlTkxcaSCUNh24NKYB9PFqwlkWjrKM5xxvYdKttPg== X-Received: by 2002:adf:e550:: with SMTP id z16mr4739088wrm.5.1582712169576; Wed, 26 Feb 2020 02:16:09 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:09 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH 03/10] bisect--helper: finish porting `bisect_start()` to C Date: Wed, 26 Feb 2020 11:14:22 +0100 Message-Id: <20200226101429.81327-4-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Add the subcommand to `git bisect--helper` and call it from git-bisect.sh. With the conversion of `bisect_auto_next()` from shell to C in a previous commit, `bisect_start()` can now be fully ported to C. So let's complete the `--bisect-start` subcommand of `git bisect--helper` so that it fully implements `bisect_start()`, and let's use this subcommand in `git-bisect.sh` instead of `bisect_start()`. This removes the signal handling we had in `bisect_start()` as we don't really need it. While at it, "trap" is changed to "handle". As "trap" is a reference to the shell "trap" builtin, which isn't used anymore. 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 | 54 +++++++++++++++++++++++++++++++--------- git-bisect.sh | 28 +++------------------ 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index c82ffe9c1c..e75e7a0837 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -583,11 +583,12 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char return bisect_next(terms, prefix); } -static int bisect_start(struct bisect_terms *terms, int no_checkout, +static enum bisect_error bisect_start(struct bisect_terms *terms, int no_checkout, const char **argv, int argc) { int i, has_double_dash = 0, must_write_terms = 0, bad_seen = 0; - int flags, pathspec_pos, res = 0; + int flags, pathspec_pos; + enum bisect_error res = BISECT_OK; struct string_list revs = STRING_LIST_INIT_DUP; struct string_list states = STRING_LIST_INIT_DUP; struct strbuf start_head = STRBUF_INIT; @@ -640,9 +641,12 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, return error(_("unrecognized option: '%s'"), arg); } else { char *commit_id = xstrfmt("%s^{commit}", arg); - if (get_oid(commit_id, &oid) && has_double_dash) - die(_("'%s' does not appear to be a valid " - "revision"), arg); + if (get_oid(commit_id, &oid) && has_double_dash) { + error(_("'%s' does not appear to be a valid " + "revision"), arg); + free(commit_id); + return BISECT_FAILED; + } string_list_append(&revs, oid_to_hex(&oid)); free(commit_id); @@ -720,12 +724,12 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, * Get rid of any old bisect state. */ if (bisect_clean_state()) - return -1; + return BISECT_FAILED; /* - * In case of mistaken revs or checkout error, or signals received, + * In case of mistaken revs or checkout error, * "bisect_auto_next" below may exit or misbehave. - * We have to trap this to be able to clean up using + * We have to handle this to be able to clean up using * "bisect_clean_state". */ @@ -741,7 +745,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, } if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0, UPDATE_REFS_MSG_ON_ERR)) { - res = -1; + res = BISECT_FAILED; goto finish; } } @@ -753,25 +757,51 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout, for (i = 0; i < states.nr; i++) if (bisect_write(states.items[i].string, revs.items[i].string, terms, 1)) { - res = -1; + res = BISECT_FAILED; goto finish; } if (must_write_terms && write_terms(terms->term_bad, terms->term_good)) { - res = -1; + res = BISECT_FAILED; goto finish; } res = bisect_append_log_quoted(argv); if (res) - res = -1; + res = BISECT_FAILED; finish: string_list_clear(&revs, 0); string_list_clear(&states, 0); strbuf_release(&start_head); strbuf_release(&bisect_names); + if (res) + return res; + + res = bisect_auto_next(terms, NULL); + /* + * In case of mistaken revs or checkout error, or signals received, + * "bisect_auto_next" below may exit or misbehave. + * We have to handle this to be able to clean up using + * "bisect_clean_state". + * return code BISECT_INTERNAL_SUCCESS_MERGE_BASE is special code + * that indicates special success. + * -> bisect_start() + * . res = bisect_auto_next() + * -> bisect_auto_next() + * . return bisect_next() + * -> bisect_next() + * . res = bisect_next_all() + * -> bisect_next_all() + * . res = check_good_are_ancestors_of_bad() + * -> check_good_are_ancestors_of_bad() + * . res = check_merge_bases() + * -> check_merge_bases() + * . res = BISECT_INTERNAL_SUCCESS_MERGE_BASE + */ + if (res && res != BISECT_INTERNAL_SUCCESS_MERGE_BASE) + bisect_clean_state(); return res; } diff --git a/git-bisect.sh b/git-bisect.sh index e03f210d55..166f6a64dd 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -63,34 +63,13 @@ bisect_autostart() { [Nn]*) exit ;; esac - bisect_start + git bisect--helper --bisect-start else exit 1 fi } } -bisect_start() { - git bisect--helper --bisect-start $@ || exit - - # - # Change state. - # In case of mistaken revs or checkout error, or signals received, - # "bisect_auto_next" below may exit or misbehave. - # We have to trap this to be able to clean up using - # "bisect_clean_state". - # - trap 'git bisect--helper --bisect-clean-state' 0 - trap 'exit 255' 1 2 3 15 - - # - # Check if we can proceed to the next bisect state. - # - git bisect--helper --bisect-auto-next || exit - - trap '-' 0 -} - bisect_skip() { all='' for arg in "$@" @@ -183,8 +162,7 @@ bisect_replay () { get_terms case "$command" in start) - cmd="bisect_start $rev" - eval "$cmd" ;; + eval "git bisect--helper --bisect-start $rev" ;; "$TERM_GOOD"|"$TERM_BAD"|skip) git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;; terms) @@ -283,7 +261,7 @@ case "$#" in help) git bisect -h ;; start) - bisect_start "$@" ;; + git bisect--helper --bisect-start "$@" ;; bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") bisect_state "$cmd" "$@" ;; skip) From patchwork Wed Feb 26 10:14:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D91914E3 for ; Wed, 26 Feb 2020 10:16:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D18A222C2 for ; Wed, 26 Feb 2020 10:16:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tKk1EXHx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727894AbgBZKQP (ORCPT ); Wed, 26 Feb 2020 05:16:15 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55760 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbgBZKQN (ORCPT ); Wed, 26 Feb 2020 05:16:13 -0500 Received: by mail-wm1-f67.google.com with SMTP id q9so2299551wmj.5 for ; Wed, 26 Feb 2020 02:16: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=Pm2riwuEDG2cRwskss3EXJBA8dK9c4i6zEALvYUar9E=; b=tKk1EXHxewM68MRkqcq5fmCFLkNWmUQjyiruqmSmNez/tCsDKBR3gvFeegk/pI25pK /p+F0nAt5PMbFjqcI+NfL133AzKGVML/sItDea2pz7F/4PUqFvJBSxD63M0jGjjIvmvF h5tjddyMxwmoc86F6u79mRhNTB7Qm/i8SgRYwGDTadNFSyQDXOChzQA4TNUlGFBLPhfk BK7hntKGhwNESaVfraguGuAu23sAMimY2SBkuWdbm45dQJ65kQrQrhW2XXnL1hple8GH eSy0wsfHwP/ElV8gaIPQJr6R1XTceRsMhdk4h9ecLPFxTTx87FNRd+hmMe9w8XRAFsnv 9xog== 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=Pm2riwuEDG2cRwskss3EXJBA8dK9c4i6zEALvYUar9E=; b=Li2NzdGfTDhNSpNPJ6I47cR1yrvFqx2+p1vHTagS9ewZOXsOYHEKMW9mlet4kOyiRj XBusiPseilaXY9SXbMk+g5ZOBJBgFk270QZ06QbgW25vDBsTb0RSrwmdgQUZXQUulH8h 5Cz33oqxjU+CFFstPtrrEthAo6+i+f6YQ1g2ypATBzNssD9qcGW9F1VANgtfXCbCgCNr 6d6xToH3tsX10K6Rvd5uWcPiKF9ijdG2vjE/5L/2MNiogUUjUyXNzQDAyPZ6Kb6bijeh F4RbEZcgRIE2CFVS27cAp1xVpmSgaQdZGXkSuTHutyur4xYdhpi4oNMNDRnUXCUitOt0 0Deg== X-Gm-Message-State: APjAAAXJMy0IOiJQpen1eXLgAcpYIWMTGU3TgjTKDcIoC3Tbx5OcQbb+ LFfXpQshCa+bsD4IBsn0V/+dwU81 X-Google-Smtp-Source: APXvYqw5o3SRXkBJaDewm+hQCvzjmrTjPaRbueiu2+MzjEpVz89qwgoiYdeM2oLU6wL54lUNLm694w== X-Received: by 2002:a1c:1f51:: with SMTP id f78mr4668445wmf.60.1582712170871; Wed, 26 Feb 2020 02:16:10 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:10 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH 04/10] bisect--helper: retire `--bisect-clean-state` subcommand Date: Wed, 26 Feb 2020 11:14:23 +0100 Message-Id: <20200226101429.81327-5-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--bisect-clean-state` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_clean_state()` is directly called from the C implementation. Mentored-by: Lars Schneider Mentored-by: Christian Couder Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index e75e7a0837..1792751179 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -22,7 +22,6 @@ static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --next-all [--no-checkout]"), N_("git bisect--helper --write-terms "), - N_("git bisect--helper --bisect-clean-state"), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), N_("git bisect--helper --bisect-check-and-set-terms "), @@ -810,7 +809,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) enum { NEXT_ALL = 1, WRITE_TERMS, - BISECT_CLEAN_STATE, CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, @@ -827,8 +825,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("perform 'git bisect next'"), NEXT_ALL), OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), - OPT_CMDMODE(0, "bisect-clean-state", &cmdmode, - N_("cleanup the bisection state"), BISECT_CLEAN_STATE), OPT_CMDMODE(0, "check-expected-revs", &cmdmode, N_("check for expected revs"), CHECK_EXPECTED_REVS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, @@ -870,10 +866,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (argc != 2) return error(_("--write-terms requires two arguments")); return write_terms(argv[0], argv[1]); - case BISECT_CLEAN_STATE: - if (argc != 0) - return error(_("--bisect-clean-state requires no arguments")); - return bisect_clean_state(); case CHECK_EXPECTED_REVS: check_expected_revs(argv, argc); return 0; From patchwork Wed Feb 26 10:14:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405869 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A894E14E3 for ; Wed, 26 Feb 2020 10:16:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88C7324670 for ; Wed, 26 Feb 2020 10:16:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mAmmZLVi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727905AbgBZKQR (ORCPT ); Wed, 26 Feb 2020 05:16:17 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39869 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727686AbgBZKQQ (ORCPT ); Wed, 26 Feb 2020 05:16:16 -0500 Received: by mail-wm1-f66.google.com with SMTP id c84so2369862wme.4 for ; Wed, 26 Feb 2020 02:16:14 -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=CVB4seLHVfIiwJJD9XnKMYBGthqGVKE6zCwSyWAb6AU=; b=mAmmZLVikO8hJmakaUQL54qO2Ye7UqAmty/VmtiKKHtq1Uj9tnNKjM9FvGtU18ETOs IeUrsuyiHe7BLvQ6uI1RS3OhvfYE0bfo4/z1KW/nGVoKdk88MZfxt2LH1u7dhyYFMvS9 dWtiwR/jfrk+cgGe2DX4Yqv72W/NK23C4fQNhDWLkPMudAFxiwXTME4Tf3fsll2A2oHH QRena32hAR6GKH98Z3ULvqub1S/+ORm5gLd+AXCVUxmfhLnz5qBqRtbzXoABB1UWAzAz YGelN3/O3u5EMyV2tIvgSlPHYSMLc/sPhigRoson3fKCQEOfgQf1hBL4EtV6VE1XRBDI +Qjg== 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=CVB4seLHVfIiwJJD9XnKMYBGthqGVKE6zCwSyWAb6AU=; b=KJ8juQ8E76IrFvYD0Y82nExIBi2Bep/RJPvTqEGPMLPeBbbljBsXr2fzIjSg/9GKgN gdL4aOuhwCDgXW6JYfVkwn3PDCMc7c2kRxIx2Drmx9MfH7pXyilD/VecvYJ+Pz93XOey wCRUIiN5K7/9Bu7RjhjEPBz8LyH3er9lZrCA/OqtLiZIirrSgLYYXKHRr7znaQIge7mm PsRZArA1V4JA9C4F9kMtkhVWKRhGk+YU9JlN7j0YINTOtODgQzobWI8kRQTUuBoz7v4b 9kY7vrxPwEvcYWVyF576IF5ffjqLTrVDANSYv1WByFcWB7tXLtjsthbRXgiu+Zgvycqd wIeQ== X-Gm-Message-State: APjAAAV8tb9YqK7AyVrJVTT9pLzYYc2Iq4CELbMmBaIoQX8+wXN6NalR ZXzqYTsg5xmpXINlThfpq7AAjViY X-Google-Smtp-Source: APXvYqyltwQV2tRDGA9BMVopA2O9lGka4KSh1PVMhzxu9H/YFAGmmfmfOzWhQk63LXGGj8MBHKhFiw== X-Received: by 2002:a1c:67c3:: with SMTP id b186mr4665946wmc.36.1582712172548; Wed, 26 Feb 2020 02:16:12 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:11 -0800 (PST) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH 05/10] bisect--helper: retire `--next-all` subcommand Date: Wed, 26 Feb 2020 11:14:24 +0100 Message-Id: <20200226101429.81327-6-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--next-all` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_next_all()` is called from the C implementation of `bisect_next()`. Mentored-by: Lars Schneider Mentored-by: Christian Couder Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 1792751179..c3bb936a40 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_head_name, "head-name") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --next-all [--no-checkout]"), N_("git bisect--helper --write-terms "), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), @@ -807,8 +806,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int no_checkou int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - NEXT_ALL = 1, - WRITE_TERMS, + WRITE_TERMS = 1, CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, @@ -821,8 +819,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { - OPT_CMDMODE(0, "next-all", &cmdmode, - N_("perform 'git bisect next'"), NEXT_ALL), OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), OPT_CMDMODE(0, "check-expected-revs", &cmdmode, @@ -859,9 +855,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case NEXT_ALL: - res = bisect_next_all(the_repository, prefix, no_checkout); - break; case WRITE_TERMS: if (argc != 2) return error(_("--write-terms requires two arguments")); From patchwork Wed Feb 26 10:14:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D17391805 for ; Wed, 26 Feb 2020 10:16:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B1A59222C2 for ; Wed, 26 Feb 2020 10:16:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XwcIM5mR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727916AbgBZKQR (ORCPT ); Wed, 26 Feb 2020 05:16:17 -0500 Received: from mail-wm1-f53.google.com ([209.85.128.53]:39099 "EHLO mail-wm1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbgBZKQQ (ORCPT ); Wed, 26 Feb 2020 05:16:16 -0500 Received: by mail-wm1-f53.google.com with SMTP id c84so2370009wme.4 for ; Wed, 26 Feb 2020 02:16:16 -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=fwaFBmY1I9+bJ0iOkZeTf1r9fPmgP9t5FK7ijAcwtJc=; b=XwcIM5mR2tBSxmGJ69QrPpeCMyCGwYby8g1PTcGPrgSQKPewX2a5GC9Dyk1Gu4E0Xd rSA9LGIcfdHLK8XFwH0gFzynrixff8ipnR6rLjv6NVUQmHJ3BS5EhQaDYffip8WGoa7E E6g1biUObuPcqv0egd/OAiI3QRbE/w/Uw2nfN2K1qQkolcSJaDQ4ssEXoMAges8i0oBA GWREjRf/6CjkC9z6TgozSkPJy6wUo1oH0RcZ7uDR+wnFumsvztLp/r+w7PiULfp+B7y8 hbmGbJaZh4xUGBSHQk9iI5UuYGLsqPhUnTjqC+vBcxcjB0IlIujbDehTGwWe0NwHN+IX OGag== 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=fwaFBmY1I9+bJ0iOkZeTf1r9fPmgP9t5FK7ijAcwtJc=; b=PhTbL6IGT4isc4LwfqDvzSVT6ruoM2q9rskNR+IyyXpVChXruXB5Btch7q0OXVDo3g 1ul0zng6Nw1wM4vCMiBn/1e6UMe1RXh2WkCLAaOS0+ZLFkGEuqy7jxTAkN0/m7UZBigP vNM7eXZO/D4XH8c3MJ2fdxmWz/haXJOD+T8KWu3v4fpzq4SZW1GYIvQDvfKZe97TO4Kg c9ABk+o6p+bIvwDdlYR1NfTmJTUBFtGqXctiJ8H1KMHlNKFiu9H5gUTQF3Y1d+XiLxI7 TbGlB1kpmqcka2T2n+NhkuGaptXGzYpTSLF5ETtY2wKS91bcBd7/pH+KRyPUhYWp/rXN wnsQ== X-Gm-Message-State: APjAAAVaIB3erQW8yOPAaXY1EQzF+p6YYu69LS0p1+gjnG2TMyRlpKtS 7STXF8bmNvXH5MsPd1au+ISL9tRMTfo= X-Google-Smtp-Source: APXvYqxFlRwRiCPqmiipxqo7L9/UK/ocGHgyaAXf605Rnlc86nOxsPROE33/aS6v2VcNls8iuQ2qZQ== X-Received: by 2002:a1c:38c7:: with SMTP id f190mr4545631wma.94.1582712173946; Wed, 26 Feb 2020 02:16:13 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:13 -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 06/10] bisect--helper: reimplement `bisect_autostart` shell function in C Date: Wed, 26 Feb 2020 11:14:25 +0100 Message-Id: <20200226101429.81327-7-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_autostart()` shell function in C and add the C implementation from `bisect_next()` which was previously left uncovered. Also add a subcommand `--bisect-autostart` to `git bisect--helper` be called from `bisect_state()` from git-bisect.sh . Using `--bisect-autostart` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. As more functions are ported, this subcommand will be retired and bisect_autostart() will be called directly by `bisect_state()`. 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 | 39 +++++++++++++++++++++++++++++++++++++++ git-bisect.sh | 23 +---------------------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index c3bb936a40..f9b04bee23 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -30,6 +30,7 @@ static const char * const git_bisect_helper_usage[] = { "[--no-checkout] [ [...]] [--] [...]"), N_("git bisect--helper --bisect-next"), N_("git bisect--helper --bisect-auto-next"), + N_("git bisect--helper --bisect-autostart"), NULL }; @@ -56,6 +57,8 @@ static void set_terms(struct bisect_terms *terms, const char *bad, static const char vocab_bad[] = "bad|new"; static const char vocab_good[] = "good|old"; +static int bisect_autostart(struct bisect_terms *terms); + /* * Check whether the string `term` belongs to the set of strings * included in the variable arguments. @@ -555,6 +558,7 @@ static enum bisect_error bisect_next(struct bisect_terms *terms, const char *pre int no_checkout; enum bisect_error res; + bisect_autostart(terms); if (bisect_next_check(terms, terms->term_good)) return BISECT_FAILED; @@ -803,6 +807,32 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int no_checkou return res; } +static int bisect_autostart(struct bisect_terms *terms) +{ + if (is_empty_or_missing_file(git_path_bisect_start())) { + const char *yesno; + const char *argv[] = {NULL}; + fprintf(stderr, _("You need to start by \"git bisect " + "start\"\n")); + + if (!isatty(STDIN_FILENO)) + return 1; + + /* + * TRANSLATORS: Make sure to include [Y] and [n] in your + * translation. The program will only accept English input + * at this point. + */ + yesno = git_prompt(_("Do you want me to do it for you " + "[Y/n]? "), PROMPT_ECHO); + if (starts_with(yesno, _("n")) || starts_with(yesno, _("N"))) + return 1; + + return bisect_start(terms, 0, argv, 0); + } + return BISECT_OK; +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -816,6 +846,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_NEXT, BISECT_AUTO_NEXT, + BISECT_AUTOSTART, } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -839,6 +870,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("find the next bisection commit"), BISECT_NEXT), OPT_CMDMODE(0, "bisect-auto-next", &cmdmode, N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), + OPT_CMDMODE(0, "bisect-autostart", &cmdmode, + N_("start the bisection if BISECT_START is empty or missing"), BISECT_AUTOSTART), OPT_BOOL(0, "no-checkout", &no_checkout, N_("update BISECT_HEAD instead of checking out the current commit")), OPT_BOOL(0, "no-log", &nolog, @@ -905,6 +938,12 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_auto_next(&terms, prefix); break; + case BISECT_AUTOSTART: + if (argc) + return error(_("--bisect-autostart requires 0 arguments")); + set_terms(&terms, "bad", "good"); + res = bisect_autostart(&terms); + break; default: return error("BUG: unknown subcommand '%d'", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 166f6a64dd..049ffacdff 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -49,27 +49,6 @@ bisect_head() fi } -bisect_autostart() { - test -s "$GIT_DIR/BISECT_START" || { - gettextln "You need to start by \"git bisect start\"" >&2 - if test -t 0 - then - # TRANSLATORS: Make sure to include [Y] and [n] in your - # translation. The program will only accept English input - # at this point. - gettext "Do you want me to do it for you [Y/n]? " >&2 - read yesno - case "$yesno" in - [Nn]*) - exit ;; - esac - git bisect--helper --bisect-start - else - exit 1 - fi - } -} - bisect_skip() { all='' for arg in "$@" @@ -86,7 +65,7 @@ bisect_skip() { } bisect_state() { - bisect_autostart + git bisect--helper --bisect-autostart state=$1 git bisect--helper --check-and-set-terms $state $TERM_GOOD $TERM_BAD || exit get_terms From patchwork Wed Feb 26 10:14:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C7E314E3 for ; Wed, 26 Feb 2020 10:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72B09222C2 for ; Wed, 26 Feb 2020 10:16:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mErzXYaP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727928AbgBZKQT (ORCPT ); Wed, 26 Feb 2020 05:16:19 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46983 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbgBZKQS (ORCPT ); Wed, 26 Feb 2020 05:16:18 -0500 Received: by mail-wr1-f68.google.com with SMTP id j7so2183032wrp.13 for ; Wed, 26 Feb 2020 02:16:17 -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=Fulm3CjI26d9VOL5FFFdXoXKHBsKpl+F/VrnOyzKu4s=; b=mErzXYaPGgJuAG1+uEULJuQy+PR2kw3wuRXoh1xxjj3ekQcpSy2sQ39F/01h6QBO+E QE+I8j66vjgX5cJZjvEXhKsg/uI6fXQRfipyxOkNGAMHnEQbelCVO9OHDp510wsDI8tV Q8ItxKEcS3djvuE6cQuzsNafQSw+m8SsgK2se6iySJnb6QHRl77I5IMYedFRXki3gHBE Er87LBwPtixy+TcuH4CIKs54HWk966xlJKQ4yrS3RP4o4vHVC1voC8VqwbaEzkaLkZVg VUNBF73KA0pGQEtr72n7+q2soRRNJrQdkHHZcAgVUArrkiPItzDT9bUkPhiJOgu/jfFZ KL6g== 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=Fulm3CjI26d9VOL5FFFdXoXKHBsKpl+F/VrnOyzKu4s=; b=CJ0RMhDnQjQVYp7I6nRaqdnGif960/HcwFpFYlrRjjR9wAGTuxRks/f3YMckKXabR9 7xMhV9SIVp8tsHn5gDHFg41qJdfNDEIvXuYT2im7kDQBw1aBeNtyvMRIrEFXyN4t46P4 6riL15PcP5HcjSQt/UEkNL8FjXFBH9iHcsFqLhkFnJ65gT7h+r47lq2jSJ2QbwF+re65 4alMtKBOFDwyDo/cVDD6aa5EJNhhMmOksemTy0whY4RHtQGOCpKozaBjnSyrv2vFnWVl 2Vf5G/JeHm/pIYKElRXkHgZX5fsDDQskuV7H+zlE7tRGcEudH+72EqqcOYQW8qipSJG3 8rUA== X-Gm-Message-State: APjAAAXmLg4neMQJqgCQ976ChaT662DZwwx5y7jwQG329fXIs6tSQL9b SKVHehB4JCs/Y7FL5HjtUeQRSsW8P1g= X-Google-Smtp-Source: APXvYqxVscQfHm86mk3XS44XLZx4irEApiiWXrORfq86GEarxvUTqBwyXg/9DzXVChjAyPIV4veM/w== X-Received: by 2002:adf:e80e:: with SMTP id o14mr4620412wrm.212.1582712175922; Wed, 26 Feb 2020 02:16:15 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:15 -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 07/10] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Date: Wed, 26 Feb 2020 11:14:26 +0100 Message-Id: <20200226101429.81327-8-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva Reimplement the `bisect_state()` shell functions in C and also add a subcommand `--bisect-state` to `git-bisect--helper` to call them from git-bisect.sh . Using `--bisect-state` subcommand is a temporary measure to port shell function to C so as to use the existing test suite. As more functions are ported, this subcommand will be retired and will be called by some other methods. `bisect_head()` is only called from `bisect_state()`, thus it is not required to introduce another subcommand. 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 | 80 ++++++++++++++++++++++++++++++++++++++++ git-bisect.sh | 55 ++------------------------- 2 files changed, 84 insertions(+), 51 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index f9b04bee23..fedcad4d9b 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -31,6 +31,8 @@ static const char * const git_bisect_helper_usage[] = { N_("git bisect--helper --bisect-next"), N_("git bisect--helper --bisect-auto-next"), N_("git bisect--helper --bisect-autostart"), + N_("git bisect--helper --bisect-state (bad|new) []"), + N_("git bisect--helper --bisect-state (good|old) [...]"), NULL }; @@ -833,6 +835,74 @@ static int bisect_autostart(struct bisect_terms *terms) return BISECT_OK; } +static char *bisect_head(void) +{ + if (is_empty_or_missing_file(git_path_bisect_head())) + return "HEAD"; + else + return "BISECT_HEAD"; +} + +static enum bisect_error bisect_state(struct bisect_terms *terms, const char **argv, + int argc) +{ + const char *state = argv[0]; + + if (check_and_set_terms(terms, state)) + return BISECT_FAILED; + + if (!argc) + return error(_("Please call `--bisect-state` with at least one argument")); + + if (argc == 1 && one_of(state, terms->term_good, + terms->term_bad, "skip", NULL)) { + const char *bisected_head = xstrdup(bisect_head()); + const char *hex[1]; + struct object_id oid; + + if (get_oid(bisected_head, &oid)) + return error(_("Bad rev input: %s"), bisected_head); + if (bisect_write(state, oid_to_hex(&oid), terms, 0)) + return BISECT_FAILED; + + *hex = xstrdup(oid_to_hex(&oid)); + check_expected_revs(hex, 1); + return bisect_auto_next(terms, NULL); + } + + if ((argc == 2 && !strcmp(state, terms->term_bad)) || + one_of(state, terms->term_good, "skip", NULL)) { + int i; + struct string_list hex = STRING_LIST_INIT_DUP; + + for (i = 1; i < argc; i++) { + struct object_id oid; + + if (get_oid(argv[i], &oid)) { + string_list_clear(&hex, 0); + return error(_("Bad rev input: %s"), argv[i]); + } + string_list_append(&hex, oid_to_hex(&oid)); + } + for (i = 0; i < hex.nr; i++) { + const char **hex_string = (const char **) &hex.items[i].string; + if (bisect_write(state, *hex_string, terms, 0)) { + string_list_clear(&hex, 0); + return BISECT_FAILED; + } + check_expected_revs(hex_string, 1); + } + string_list_clear(&hex, 0); + return bisect_auto_next(terms, NULL); + } + + if (!strcmp(state, terms->term_bad)) + return error(_("'git bisect %s' can take only one argument."), + terms->term_bad); + + return BISECT_FAILED; +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -847,6 +917,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_NEXT, BISECT_AUTO_NEXT, BISECT_AUTOSTART, + BISECT_STATE } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { @@ -872,6 +943,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), OPT_CMDMODE(0, "bisect-autostart", &cmdmode, N_("start the bisection if BISECT_START is empty or missing"), BISECT_AUTOSTART), + OPT_CMDMODE(0, "bisect-state", &cmdmode, + N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_BOOL(0, "no-checkout", &no_checkout, N_("update BISECT_HEAD instead of checking out the current commit")), OPT_BOOL(0, "no-log", &nolog, @@ -944,6 +1017,13 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) set_terms(&terms, "bad", "good"); res = bisect_autostart(&terms); break; + case BISECT_STATE: + if (!argc) + return error(_("--bisect-state requires at least one revision")); + set_terms(&terms, "bad", "good"); + get_terms(&terms); + res = bisect_state(&terms, argv, argc); + break; default: return error("BUG: unknown subcommand '%d'", cmdmode); } diff --git a/git-bisect.sh b/git-bisect.sh index 049ffacdff..7f10187055 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -39,16 +39,6 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" TERM_BAD=bad TERM_GOOD=good -bisect_head() -{ - if test -f "$GIT_DIR/BISECT_HEAD" - then - echo BISECT_HEAD - else - echo HEAD - fi -} - bisect_skip() { all='' for arg in "$@" @@ -61,43 +51,7 @@ bisect_skip() { esac all="$all $revs" done - eval bisect_state 'skip' $all -} - -bisect_state() { - git bisect--helper --bisect-autostart - state=$1 - git bisect--helper --check-and-set-terms $state $TERM_GOOD $TERM_BAD || exit - get_terms - case "$#,$state" in - 0,*) - die "Please call 'bisect_state' with at least one argument." ;; - 1,"$TERM_BAD"|1,"$TERM_GOOD"|1,skip) - bisected_head=$(bisect_head) - rev=$(git rev-parse --verify "$bisected_head") || - die "$(eval_gettext "Bad rev input: \$bisected_head")" - git bisect--helper --bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit - git bisect--helper --check-expected-revs "$rev" ;; - 2,"$TERM_BAD"|*,"$TERM_GOOD"|*,skip) - shift - hash_list='' - for rev in "$@" - do - sha=$(git rev-parse --verify "$rev^{commit}") || - die "$(eval_gettext "Bad rev input: \$rev")" - hash_list="$hash_list $sha" - done - for rev in $hash_list - do - git bisect--helper --bisect-write "$state" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit - done - git bisect--helper --check-expected-revs $hash_list ;; - *,"$TERM_BAD") - die "$(eval_gettext "'git bisect \$TERM_BAD' can take only one argument.")" ;; - *) - usage ;; - esac - git bisect--helper --bisect-auto-next + eval git bisect--helper --bisect-state 'skip' $all } bisect_visualize() { @@ -185,8 +139,7 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 state="$TERM_GOOD" fi - # We have to use a subshell because "bisect_state" can exit. - ( bisect_state $state >"$GIT_DIR/BISECT_RUN" ) + ( git bisect--helper --bisect-state $state >"$GIT_DIR/BISECT_RUN" ) res=$? cat "$GIT_DIR/BISECT_RUN" @@ -201,7 +154,7 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2 if [ $res -ne 0 ] then eval_gettextln "bisect run failed: -'bisect_state \$state' exited with error code \$res" >&2 +'git bisect--helper --bisect-state \$state' exited with error code \$res" >&2 exit $res fi @@ -242,7 +195,7 @@ case "$#" in start) git bisect--helper --bisect-start "$@" ;; bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD") - bisect_state "$cmd" "$@" ;; + git bisect--helper --bisect-state "$cmd" "$@" ;; skip) bisect_skip "$@" ;; next) From patchwork Wed Feb 26 10:14:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21D9414D5 for ; Wed, 26 Feb 2020 10:16:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01E1924670 for ; Wed, 26 Feb 2020 10:16:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QLEncRj1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727934AbgBZKQU (ORCPT ); Wed, 26 Feb 2020 05:16:20 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41678 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbgBZKQT (ORCPT ); Wed, 26 Feb 2020 05:16:19 -0500 Received: by mail-wr1-f65.google.com with SMTP id v4so2224945wrs.8 for ; Wed, 26 Feb 2020 02:16:18 -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=SxFmHPzLSjqQLb9n3yWLdrxL/nDy8gFWLI6z0FY5NKo=; b=QLEncRj1kEwWsdCrYsiBnA051yBIVbNb24+c4HwJADMBCwmgKtjNgG6CHtEtjSfSZ+ 4Hj/BmFX4fTusErIuTbGDhPwmScDMoX4WU+kCKfIEfxPn5PD0ebjpsllIxJmJ4d73V1p zUKqRToQMPJUjqCY5d17x8lcUzopb0WnQxM34At36xtW9Rk9cVhgxVnEq/B8bQl1KTzT 0un2on6FS5Y2RqSdnNx5ZaW9x9IYQFrpvFZYPPq14CFGeZmYL+xugE1R75Xbka9HryYR LMcvF+GSBrP24t9Rb8DOf4MoIAq5NYfmJO0wx6oDGDyvxNzYMl6z13fW1Ity/ROadsGK QJhg== 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=SxFmHPzLSjqQLb9n3yWLdrxL/nDy8gFWLI6z0FY5NKo=; b=uWD7fYoGhVhmaLoSvhAVME+UbvbxTHK5AjBETGHXQcaturJEKKtCPM0SUyjK2C+08z NYqswXOxIu5alEmaLJDlw0QygqFGhIED5c+UhKA7kQocqFjx0ZVwhhl8T4v+4fwsxgMK cs3CbfIBrerIIzTDORjXLdpZQ1vD3A4KynZCiPkoPwBic85KHIMF3q/z+CR5+83IlDDs cB0Vn+8YlLdM0M0mujsOufrxyyHqsxkNBLeVCLiekow1faEtC4Boa3nZ18TSuLWX94UC IaU6du5wMUpUwhCZXuD9y3O5RlUHexUwF1OaJj5Yau9C0DOzAAnNxYmxM3bLU6tosvgu o1kQ== X-Gm-Message-State: APjAAAX5FuaimLf85uRu9s5HmKYK9bV7yqP6I10/7BsZUI/QoryTa7Tm FaDJJJbkpqCEGxjfL2es5Q6URyYfMPk= X-Google-Smtp-Source: APXvYqyGyt4UDcvDy7dQw65CdOc73oWqnjIyAIxQ8xEcnHlRL2DS9eYDZxz7+BRQmeoufrPXlpyPuQ== X-Received: by 2002:adf:ef8e:: with SMTP id d14mr4573803wro.316.1582712177303; Wed, 26 Feb 2020 02:16:17 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:16 -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 08/10] bisect--helper: retire `--check-expected-revs` subcommand Date: Wed, 26 Feb 2020 11:14:27 +0100 Message-Id: <20200226101429.81327-9-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--check-expected-revs` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `check_expected_revs()` is called from the C implementation of `bisect-next()`. 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 | 6 ------ 1 file changed, 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index fedcad4d9b..c2fd3ee1b3 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -907,7 +907,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { WRITE_TERMS = 1, - CHECK_EXPECTED_REVS, BISECT_RESET, BISECT_WRITE, CHECK_AND_SET_TERMS, @@ -923,8 +922,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) struct option options[] = { OPT_CMDMODE(0, "write-terms", &cmdmode, N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), - OPT_CMDMODE(0, "check-expected-revs", &cmdmode, - N_("check for expected revs"), CHECK_EXPECTED_REVS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-write", &cmdmode, @@ -965,9 +962,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) if (argc != 2) return error(_("--write-terms requires two arguments")); return write_terms(argv[0], argv[1]); - case CHECK_EXPECTED_REVS: - check_expected_revs(argv, argc); - return 0; case BISECT_RESET: if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); From patchwork Wed Feb 26 10:14:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4AB014D5 for ; Wed, 26 Feb 2020 10:16:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9798C20838 for ; Wed, 26 Feb 2020 10:16:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="El3sN6HX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727948AbgBZKQV (ORCPT ); Wed, 26 Feb 2020 05:16:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34444 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbgBZKQU (ORCPT ); Wed, 26 Feb 2020 05:16:20 -0500 Received: by mail-wr1-f65.google.com with SMTP id z15so2270465wrl.1 for ; Wed, 26 Feb 2020 02:16:19 -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=5SnT74Enlxv8HE4//5YhW4aF0hAlv10LauSUC5ad9zI=; b=El3sN6HXCWdl1c0vLQIKUDyBKEyd+qqxxg4rUH89GEPTf/skyb3RdoKaYcbiS91LYu SmXU0HelJyymBCPfKSa1mJwnRrleOU7h7rZQDuntmx8ZbodX0vlDUiSvNG8tWypa9MLL pMY5aoL8LW1pVGoVp4yuHkBv2ltG/U4FGTSY5KknzFkKS8HqPhDYNpZ3ubJ0y2xhWDye vXsPFKaq15DPNv8z0/rhBitfGVCU1Dhw+hmC5rAVvBgsXqGcSRMK2i/qP8HZlYoJQHA6 QukRbfR9DWGTrYROPMKBNi+hHNyycJzEFkz+ua/OWf1KZwbNpyY7BNN5Nq8RmM+9ZGtr pr/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SnT74Enlxv8HE4//5YhW4aF0hAlv10LauSUC5ad9zI=; b=Ee78Kn5+0ebCbCSwIP2HBsTa8ani56AQycBg1KZI0f34UnjjnGNkkDxr4Dpu9GPg6C o7youMO7UrMx61ywC+TIJqKRX69ahKH5yOpPAJl8W4TlrtM3o5FuPGwXiFvnFk+pHfZs cAUIizYkjWm8wj75Z5PFsLGv3K8YCyLCUvuQNO0JZlqzSeZCfCvfhwKnDfPzS/Nmnbhq oD9Mqluyv90qGTdC3ZmmtzvkAK4WWiSMrvggr4yQMfssFgwnexbC+AfA402ermzrVbGW 44GuQqsBua+3up6oaRE64gcUZaBuJaW3k+0rdKs8ZmcC4u9dfM330vI3LDEkZYBfC0od ye/A== X-Gm-Message-State: APjAAAVSR1CTFZSa4H7F1L2Omp9PvghAtLOKA+ZaCwr6UOS2Hag/ARtz s2EJPM61XQH0KL+PM7IMUkgA6imdq3w= X-Google-Smtp-Source: APXvYqwybiAJaYrzBKcX03sRmuaBws8y2lFDhwRRgCmuLZilBgX3i/ZJNfU8sZP7+OeaftCSWRwI3w== X-Received: by 2002:a5d:6191:: with SMTP id j17mr4383907wru.427.1582712178673; Wed, 26 Feb 2020 02:16:18 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:18 -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 09/10] bisect--helper: retire `--write-terms` subcommand Date: Wed, 26 Feb 2020 11:14:28 +0100 Message-Id: <20200226101429.81327-10-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--write-terms` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `write_terms()` is called from the C implementation of `set_terms()` and `bisect_start()`. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index c2fd3ee1b3..650ceefcd7 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -20,7 +20,6 @@ static GIT_PATH_FUNC(git_path_head_name, "head-name") static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES") static const char * const git_bisect_helper_usage[] = { - N_("git bisect--helper --write-terms "), N_("git bisect--helper --bisect-reset []"), N_("git bisect--helper --bisect-write [--no-log] "), N_("git bisect--helper --bisect-check-and-set-terms "), @@ -906,8 +905,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { - WRITE_TERMS = 1, - BISECT_RESET, + BISECT_RESET = 1, BISECT_WRITE, CHECK_AND_SET_TERMS, BISECT_NEXT_CHECK, @@ -920,8 +918,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; struct option options[] = { - OPT_CMDMODE(0, "write-terms", &cmdmode, - N_("write the terms to .git/BISECT_TERMS"), WRITE_TERMS), OPT_CMDMODE(0, "bisect-reset", &cmdmode, N_("reset the bisection state"), BISECT_RESET), OPT_CMDMODE(0, "bisect-write", &cmdmode, @@ -958,10 +954,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) usage_with_options(git_bisect_helper_usage, options); switch (cmdmode) { - case WRITE_TERMS: - if (argc != 2) - return error(_("--write-terms requires two arguments")); - return write_terms(argv[0], argv[1]); case BISECT_RESET: if (argc > 1) return error(_("--bisect-reset requires either no argument or a commit")); From patchwork Wed Feb 26 10:14:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11405879 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 990F714D5 for ; Wed, 26 Feb 2020 10:16:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 796B924656 for ; Wed, 26 Feb 2020 10:16:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DwJnHKnJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727967AbgBZKQY (ORCPT ); Wed, 26 Feb 2020 05:16:24 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40731 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbgBZKQV (ORCPT ); Wed, 26 Feb 2020 05:16:21 -0500 Received: by mail-wm1-f66.google.com with SMTP id t14so2365439wmi.5 for ; Wed, 26 Feb 2020 02:16:21 -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=4vP1F/2EPWvsd5i4FHZEtbX7J6rbdzxeMDK5RwREv4Q=; b=DwJnHKnJl4HiU4+msKBL7uaiAp6vJb4lIe4089nsF9/CuiDgNkFlOTXGzZACzUbV5H iSZZm1E8uaAqXhlIu6FaO5aqZ71QfMALct9CYgPXqDDY7GJIjGn2Z9yaDMK2gqcYPiX5 PmRLkfpd4oU18XD7DaHRKGZkBhd7ExBWnUjxeEHnPQrJOhqR0JDEm/FNK1/dEaaDHQrC Q49C+nwy2MQ8DW0JyUqv79z98HmrzP2M8vMZktcj0jNt0sAxZO8QOuUIXAp36sLKZuQz 5MjMYu7sbREgZB5O55Dsf+67Ay5E14VRxD8r933EwwWRlRNQxKtYZQoWNVeMqqPl2iKB FiTQ== 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=4vP1F/2EPWvsd5i4FHZEtbX7J6rbdzxeMDK5RwREv4Q=; b=aB6jRz4658b5DXeEW/vYvJhx9iVHeISvTe690wCgkcXs12Qn1HRmNehFJHgZCwhSAD b9ZGFKtPRvacjXGaaWrrRF3zGJ5OonVe1/dPTy2NHywgU4F4JT6GamCWwnWluVmQH+Uv Exgfec4rhQgM5l696QppEBud5ptHA2fvik0MIFTLnhKqfmbqX2CbMGEnBLmDVMCDbmqC Vc6L6YyOzU+0b95uWPaZr5CFlnsE8Kln5VRqJx+E0RMIf9pni9NncvPECGbPkDMgdVnh EQgu7l8E+RaNuqX6m8ln/c3fRqzkXgPI9eS5H2EsK3M3xpQ22zEpFOnZCwF6BJk6adI8 eEAA== X-Gm-Message-State: APjAAAWPVKzZDGFCW8+p8pJVqb4iRjTxEBG5mAB2f4VlCD3pHyBEVTK8 YlyCkniaTLacXfXpVxLeEI2AsxkhoyA= X-Google-Smtp-Source: APXvYqxhLXCMa3liSff8Jj5BZqL15bKMyX+uGlIffSRv7RhsHXixoIKyid+SN7RsUrVgJUQ1puO+Yg== X-Received: by 2002:a7b:c851:: with SMTP id c17mr4541792wml.71.1582712180014; Wed, 26 Feb 2020 02:16:20 -0800 (PST) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id t3sm2577081wrx.38.2020.02.26.02.16.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 02:16:19 -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 10/10] bisect--helper: retire `--bisect-autostart` subcommand Date: Wed, 26 Feb 2020 11:14:29 +0100 Message-Id: <20200226101429.81327-11-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200226101429.81327-1-mirucam@gmail.com> References: <20200226101429.81327-1-mirucam@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Pranit Bauva The `--bisect-autostart` subcommand is no longer used from the git-bisect.sh shell script. Instead the function `bisect_autostart()` is directly called from the C implementation. Mentored-by: Lars Schneider Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Pranit Bauva Signed-off-by: Tanushree Tumane Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 650ceefcd7..c692c660a4 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -29,7 +29,6 @@ static const char * const git_bisect_helper_usage[] = { "[--no-checkout] [ [...]] [--] [...]"), N_("git bisect--helper --bisect-next"), N_("git bisect--helper --bisect-auto-next"), - N_("git bisect--helper --bisect-autostart"), N_("git bisect--helper --bisect-state (bad|new) []"), N_("git bisect--helper --bisect-state (good|old) [...]"), NULL @@ -913,7 +912,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) BISECT_START, BISECT_NEXT, BISECT_AUTO_NEXT, - BISECT_AUTOSTART, BISECT_STATE } cmdmode = 0; int no_checkout = 0, res = 0, nolog = 0; @@ -934,8 +932,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) N_("find the next bisection commit"), BISECT_NEXT), OPT_CMDMODE(0, "bisect-auto-next", &cmdmode, N_("verify the next bisection state then checkout the next bisection commit"), BISECT_AUTO_NEXT), - OPT_CMDMODE(0, "bisect-autostart", &cmdmode, - N_("start the bisection if BISECT_START is empty or missing"), BISECT_AUTOSTART), OPT_CMDMODE(0, "bisect-state", &cmdmode, N_("mark the state of ref (or refs)"), BISECT_STATE), OPT_BOOL(0, "no-checkout", &no_checkout, @@ -997,12 +993,6 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) get_terms(&terms); res = bisect_auto_next(&terms, prefix); break; - case BISECT_AUTOSTART: - if (argc) - return error(_("--bisect-autostart requires 0 arguments")); - set_terms(&terms, "bad", "good"); - res = bisect_autostart(&terms); - break; case BISECT_STATE: if (!argc) return error(_("--bisect-state requires at least one revision"));