From patchwork Sat Mar 21 16:10:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451225 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 F381E139A for ; Sat, 21 Mar 2020 16:13:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2F9920757 for ; Sat, 21 Mar 2020 16:13:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y0DDKEQr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727602AbgCUQNx (ORCPT ); Sat, 21 Mar 2020 12:13:53 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37423 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgCUQNw (ORCPT ); Sat, 21 Mar 2020 12:13:52 -0400 Received: by mail-wr1-f65.google.com with SMTP id w10so11223989wrm.4 for ; Sat, 21 Mar 2020 09:13:51 -0700 (PDT) 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=80yv/7meo1EOAH946oEOOLjw/qEOgcPGMrV9jGnWQ4E=; b=Y0DDKEQr8yLdXNxPhMu1OaqSvBhd1UjL5UcZkeKWIL9P68bZSVzY7mvLqDqTAAHdcy 7Ur96A0BxfYUJZBQvVO4hhgce9xe4lyJssVuK1bmxnSyCMysnvxIeIiLNBll0wuzUbpg RFJvkIbyRO46Nn72bz5FHjJFl7vw3MZ7sc2TaLH+dak5gt1iCqEHc9cQ71h+betMMERw Yay8r/fvkfoAbwO/c/FIzhFtf6iIIG+mFoxLcLiV4MkKo4UKIL1a2jdFG45kxv3qxY8W GX7vripAWpxz27PRsK1mrj2X3oioQsyz+kJ3MO2cmLqgnpu6phG2XzrrHf0S6aICy/VI sRSQ== 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=80yv/7meo1EOAH946oEOOLjw/qEOgcPGMrV9jGnWQ4E=; b=JAeMC6bCVS8/JV2uRr0qBy7lpMNMLPaz7DvsJdqPTa5lX16IxSKkb5o1ku8zMI7oxj hcKCY18nsqgtrDS8pOOYp/j9v5NxA16TlbZr6+aSqb85IDL+SdUQ92/Y+HlIqmpZXVXR CazP0iiJDdX0d+CCWxx9eZFCYzo9025RieiGpCHLajDSxP9yihKhq5O5Xt8v1qiqND5n C0sqXRFNQXg1n/qM8WLLO8WBE7hjQTlzKJ80niAi9TE/uo2v9VdVhBunKRULvipyDthm 0O38upAtF9N8O9PCffq0jvj7B3xHbLr8VfidwIKtHKvJH8WZ2u8HRj0bbxy7uH5q6qBN dWIw== X-Gm-Message-State: ANhLgQ2pIq1U1ieKZakwBXrwT/JxJHXh53yt2eS8rE7gGMK8WREV/r5i J5o3OB5b7GFLGVnn5/4F2vjAvbY8 X-Google-Smtp-Source: ADFU+vs/wQIrIsQY7Xc9HnUOwCnsw91IlTh9UUIc5ZKU1mP6r2sE7qLEQ6i8AYAxblcWKUKoWmQDrQ== X-Received: by 2002:adf:ed85:: with SMTP id c5mr19156364wro.41.1584807230703; Sat, 21 Mar 2020 09:13:50 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:50 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Miriam Rubio , Christian Couder , Johannes Schindelin Subject: [PATCH v2 02/11] bisect--helper: introduce new `write_in_file()` function Date: Sat, 21 Mar 2020 17:10:11 +0100 Message-Id: <20200321161020.22817-3-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 helper will be used in later steps and makes the code simpler and easier to understand. Mentored-by: Christian Couder Mentored-by: Johannes Schindelin Signed-off-by: Miriam Rubio --- builtin/bisect--helper.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 1f81cff1d8..e949ea74e2 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -74,6 +74,26 @@ static int one_of(const char *term, ...) return res; } +static int write_in_file(const char *filepath, const char *mode, const char *format,...) +{ + FILE *fp = NULL; + va_list args; + int res = 0; + + if (!strcmp(mode, "a") && !strcmp(mode, "w")) + return error_errno(_("wrong writing mode '%s'"), mode); + fp = fopen(filepath, mode); + if (!fp) + return error_errno(_("could not open file '%s'"), filepath); + va_start(args, format); + res = vfprintf(fp, format, args); + va_end(args); + if (!res) + return error_errno(_("could not write to file '%s'"), filepath); + + return fclose(fp); +} + static int check_term_format(const char *term, const char *orig_term) { int res; @@ -104,7 +124,6 @@ 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; int res; if (!strcmp(bad, good)) @@ -113,12 +132,8 @@ 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(), "w", "%s\n%s\n", bad, good); - res = fprintf(fp, "%s\n%s\n", bad, good); - res |= fclose(fp); return (res < 0) ? -1 : 0; } From patchwork Sat Mar 21 16:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451227 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 3C99F18C6 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0825920757 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dOTE7pwY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727618AbgCUQNz (ORCPT ); Sat, 21 Mar 2020 12:13:55 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:40854 "EHLO mail-wr1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbgCUQNy (ORCPT ); Sat, 21 Mar 2020 12:13:54 -0400 Received: by mail-wr1-f46.google.com with SMTP id f3so11196967wrw.7 for ; Sat, 21 Mar 2020 09:13:53 -0700 (PDT) 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=4JO0a8t5aXj+AT9NJ3J7cudYXYDdwbzOnZ0U8gQVHaI=; b=dOTE7pwYv6YcH8lUXHb0lI++qy7HUJsqw94T0bDj0tM3trEoUwSaJ+6UuabGRJwQYQ WC/AiJudZGm9OJGHbccniZFrSrhH2kB3vjvq9YIICH7XtzIJZQAWUhDcz7R3QHA2rE/b IwsOV3ULp5A1ypLBMAZzco2Pz8ObvT3vMlHM1vLBpfpeJCQHbfn4i+rpc6RH7BJ6DuRW Rty6ySfYIeLTUo335MrLQb6AMzbk+K3QyzN3Fvzuxhs2X8yYJFwK7IFXCh7eZw30HdVz 1Xsp1kweZJAEHqx2QUUAE4eIswDcuxil6S/ay5LGhUnjViR+DYVwqTAKythUwaS9J6a3 R56g== 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=4JO0a8t5aXj+AT9NJ3J7cudYXYDdwbzOnZ0U8gQVHaI=; b=P3lpVVbh93DokBJRW//y16djUnjQoSszF+NlLz8sT5Ieo3ahzIKLobH7uFYWeZY3nc +qlGAsqImmdaax8vtfNVpuMol6OyAbabv/EcgvFB3QZmcWM3twagcxnsXfl6KULGU+y5 COIbcMYBGaEutkc0+hC/CNwc3d7o4M+TOH6nnpXdMWQ72iy0l7BZ4NGlGY9ygYnm1OxW cEvlqYJJk/362oujkwtQR2TpjLCfQGb2BdMjEO7OyU8QmdIqwGCfmKNU2DD6i4y/ABxp vVL/U2s/IKpbXFB5Iy5908zfet2YcixPyZy4KSb2WFcWj/kVqlWn6CB1sss8J06iBSV2 44ww== X-Gm-Message-State: ANhLgQ0DSYHuKCiL/Nh2pu7VOuQ8LVfysoWj6Q7is8F00oy54r0o8pMy jX32mvn8LNN+sVkQSIsyshszl65PZis= X-Google-Smtp-Source: ADFU+vtr1kdyeIlM1A+E+rO/dzY29I8OeRP0WiJsGA5FJTR4tNu7RhfmWfigqkuRh6oLnamgY9V/8w== X-Received: by 2002:adf:ea84:: with SMTP id s4mr8044330wrm.392.1584807232109; Sat, 21 Mar 2020 09:13:52 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:51 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 03/11] bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C Date: Sat, 21 Mar 2020 17:10:12 +0100 Message-Id: <20200321161020.22817-4-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 | 166 ++++++++++++++++++++++++++++++++++++++- git-bisect.sh | 47 +---------- 3 files changed, 180 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 e949ea74e2..447e9e75db 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 }; @@ -436,6 +439,149 @@ 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 argv_array *rev_argv = cb_data; + + argv_array_push(rev_argv, oid_to_hex(oid)); + return 0; +} + +static void prepare_rev_argv(struct bisect_terms *terms, struct argv_array *rev_argv) +{ + char *term_good = xstrfmt("%s-*", terms->term_good); + + argv_array_pushl(rev_argv, "skipped_commits", "refs/bisect/bad", "--not", NULL); + for_each_glob_ref_in(register_good_ref, term_good, "refs/bisect/", rev_argv); + + 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 + * sets up 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); + } + + /* + * Reset the flags used by revision walks in case + * there is another revision walk after this one. + */ + reset_revision_walk(); + + 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); + 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); + + res = write_in_file(git_path_bisect_log(), "a", "# first %s commit: [%s] %s\n", + terms->term_bad, oid_to_hex(&oid), + commit_name.buf); + + strbuf_release(&commit_name); + free(bad_ref); + 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) { @@ -640,7 +786,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[] = { @@ -664,6 +812,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, @@ -725,6 +877,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: res = error(_("BUG: unknown subcommand.")); } 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 Sat Mar 21 16:10:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451231 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 994C61864 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7873620757 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UXXdZ+lW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727630AbgCUQN5 (ORCPT ); Sat, 21 Mar 2020 12:13:57 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33673 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgCUQN4 (ORCPT ); Sat, 21 Mar 2020 12:13:56 -0400 Received: by mail-wr1-f66.google.com with SMTP id a25so11235436wrd.0 for ; Sat, 21 Mar 2020 09:13:54 -0700 (PDT) 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=aLzkw1A45ECqV1oE/u4ObEfiUhk3zfOSQEotwGzLmIg=; b=UXXdZ+lW5HKiUMza9jeQHy4K7XjhLn4/1CSaBYbUsrmc1b/JgzY10IL/SWg6HbZb7T 3FfhpRgmRUFaLrLd7lpi4piMwR8c4oh+7CIyBqCFmjwxNfjXHZLUQaYZE/fX4NWtVe9O wbG2WJu3uzM4wv7iPd6aMcWtbNtmu5piDyPp4hz6QoO9c6aawDMyk6by7N7R/wStB4Bb JTCxDKk/ATgxo9jXxL+z7hv1VYmh7spDv2p2zZh037uH8FeuI3EbQS48FT3rVY3LWB4b 64X29RVXIBJHAfY+8wQpzCQO1TpRKqO8QiPkqOFW+7b3rUxhXablT8svrlt/oFNnjjJY GGQg== 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=aLzkw1A45ECqV1oE/u4ObEfiUhk3zfOSQEotwGzLmIg=; b=qYax5JAW1+90QsnYPSAjnoh6gJB98a+vd4aRtWGWJdZ2XVcKloUBrvtK2R3C4ZY1Kf BDurVpM9I/zSE2h3kZrLbACM6NbKLMz29xG3MLTloNG8C0brqJkSpBVS1aDHdU23Zb3a g3CHUHNt+qX3Gro69s3QudbHLNfnX6AjGM7AF0Rz+Z+1qiCWw+PFDgbM/NRIvEzCEIek 2SDOQZ4sXcnFWCZCkVOg0E/qe2/XQBwc8o6M8+LxezIS3fHCbHEAXPiVG++Db59Zdvi/ B+GMHMIt13UO6BZw36BedtLJ5ST3rZKURh2VPlajMGxKyHa1pZwXI/OYECVmIJaTEUNv yHiQ== X-Gm-Message-State: ANhLgQ2PfXG6iabep3dYkBQu5Z2kGLPGDw6LVOLsSp0adYE4eDvunK+F HrlwkIYIjBMw4YTz0zUfsVMJUok+ X-Google-Smtp-Source: ADFU+vvXtmFVuNz9dCsA8baP6LAlDBSHOKu8Qk8obWfMi+QCEoY2MQMEo9ahJy70l6wohRz6hnfaSw== X-Received: by 2002:adf:c648:: with SMTP id u8mr18740626wrg.185.1584807233521; Sat, 21 Mar 2020 09:13:53 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:53 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 04/11] bisect--helper: finish porting `bisect_start()` to C Date: Sat, 21 Mar 2020 17:10:13 +0100 Message-Id: <20200321161020.22817-5-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 447e9e75db..84aac08ced 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -582,11 +582,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; @@ -639,9 +640,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); @@ -719,12 +723,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". */ @@ -740,7 +744,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; } } @@ -752,25 +756,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 Sat Mar 21 16:10:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451229 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 6F91F1894 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44AC120757 for ; Sat, 21 Mar 2020 16:13:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CtCbI1y1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbgCUQN5 (ORCPT ); Sat, 21 Mar 2020 12:13:57 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:56075 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbgCUQN4 (ORCPT ); Sat, 21 Mar 2020 12:13:56 -0400 Received: by mail-wm1-f66.google.com with SMTP id 6so9710941wmi.5 for ; Sat, 21 Mar 2020 09:13:55 -0700 (PDT) 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=Z8Yb5WR++1HxbvWIB9L6nzzudaA0Wn2XAlyOHhESk/E=; b=CtCbI1y1VZWMwP7/WtW/cXRFtRE+z3TVQb/dWRa7GiPHDfO/KP+yYYKMWitNu8abbG UFYlBXqrCBjcU5tPc5SFZFdXA/6v7zPSK5+d5oyUodLCVXn5ZKyvU4DLgMK5uG8REjWV 0vpn7wormyMi9NThFnkFcmZzrgn7B8xxmvDLMYvBM1dq07rOHMZeQlVM8wWi0qcoeYAK bDIENlu/97UEW+03S962wPwjS1vilcJL++5eSff2Le1oXWUzzoDi0T6A77ufOmTRsIQ8 5QV89vSUfx7VLr6FYtOT0AUA4GCPujv71NMrRlYTNhDW3kCv/W8qx/MG0HpkmLt7Iwy0 iUjg== 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=Z8Yb5WR++1HxbvWIB9L6nzzudaA0Wn2XAlyOHhESk/E=; b=FptAYUHo0N6roO2i/LakJ6tn6iZmlNa5pUoWxa60S0dNhY98PO4mDS0Zxdnq6+4QyA yKad0yJMsEGaQisk77G/5dy3uHe6ULkh8zpZbKn8ASv/ne1Fg2/i5Zllx+BOL37TtKTq BW6eScrOIjWDc+dGbVZYqQ9SYcykQigkLU3+gqJuO+ZjNxPuf0bjdZ3EImm2FgQkRfaE KrAoc9zfD+zfE2H20U2hhda9WR+iVr2eAUiQJT2bgmMW7fZFz0feoyLIJgMWLYNcrd3f LpXCj+lM7meMb6jjxTSKAGtcKVW4viyQQrPMMuZ14smvNaWADwUoNbQ/uVVWVm3auu4G v+rg== X-Gm-Message-State: ANhLgQ3r7uoTFB/mT/488DSqaQm71nUmeoUgzl6aHQUUoLZcKOJWbPrI J70OTBm3Y3EnI81dkGy88Vjofik+ X-Google-Smtp-Source: ADFU+vsp0emPAP1MJgprCTC6rBKMRgNfrhSqZlufIh5+uk3E1YfjJGbiaVa766NEAW0QOcTyG4QMAw== X-Received: by 2002:a1c:b356:: with SMTP id c83mr16740393wmf.10.1584807234852; Sat, 21 Mar 2020 09:13:54 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:54 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 05/11] bisect--helper: retire `--bisect-clean-state` subcommand Date: Sat, 21 Mar 2020 17:10:14 +0100 Message-Id: <20200321161020.22817-6-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 84aac08ced..0534adf216 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 "), @@ -809,7 +808,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, @@ -826,8 +824,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, @@ -869,10 +865,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 Sat Mar 21 16:10:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451233 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 94D3917E6 for ; Sat, 21 Mar 2020 16:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73CF020786 for ; Sat, 21 Mar 2020 16:14:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S9tIKjXy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbgCUQN7 (ORCPT ); Sat, 21 Mar 2020 12:13:59 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36421 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgCUQN6 (ORCPT ); Sat, 21 Mar 2020 12:13:58 -0400 Received: by mail-wr1-f66.google.com with SMTP id 31so5201481wrs.3 for ; Sat, 21 Mar 2020 09:13:57 -0700 (PDT) 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=BfIqeXydPmqmTJOYACyhK1s4kc+Xn+s619UoxOmuALI=; b=S9tIKjXy2JYNP6z9HFhhe8OfMQ/WOJLnIXLchBxmEpHNQI4Cm/9JFK4QtiMTuM48ri ca8KbvSW/S9CAkwrmlpg08MGQOd+0CZuB+VSMhkhpVUvOxhrlZ7T1gHkjpj3JX04HoXc hh9zMoO0tJpSCop0mGQO+LYUv67qAmoCjwuIqxLI/yKNaCtNmuD3zJLMpld9qsGr0K0V NbcjbmMBj9fije7smVOtq6KwH06U8TQmjTZbntPSexLHRjtvthnE+dasbiFq93BwoHUL +bKimLhMHbQHJTlmBW5DaReXhNOI6ezQYmNvgFJGfIM1s4RjvxUI7QxHrD1CNrNsiOVh GO0A== 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=BfIqeXydPmqmTJOYACyhK1s4kc+Xn+s619UoxOmuALI=; b=nFZwaZbszXbz6NOZ9hNpEDyn3C03le5Xe4J02Dr6j5gIyuLKZUtbWaD6tgBEweMM+e cjtIh8i/Sp2T8DkUI8Efb/XNg2X9ivJKFftAnmJta6sZD0Edf3B+7tfu0rtjvEV4bhvL pzCH5wmsub+hFe5NebsJjdUyaYLjcnZ0A6UwdZSZ40RYpbnvUo/W0PyS0dxveKt5Y3fE YMtAd55vWiAxrzFrbf9gDEaNX5YEoIuvOT/zBbCgs6IuKSfxO+r5kzBVZBCwOcyKhooL nad0BufjkxHB46qe34/uqdYrzcfGAcNW+mNuHWjZTKS3yc26LGk43RqPKkwthI4XovN7 EK7w== X-Gm-Message-State: ANhLgQ2xjI83mKxlCT21msM4H5RZA+9aTM3id3mAFLqxT2DghyaHOS/z VMf08CrN2muHlaRHqGKaEi1NLrtB X-Google-Smtp-Source: ADFU+vsccbv+YwGH62fz71Q3WF5gvZpY0gNoPWJ6vhZDrFBNQKpj/dZ5HHrbAtuqoY5m5dlSDJfxpw== X-Received: by 2002:adf:f58f:: with SMTP id f15mr18949485wro.16.1584807236179; Sat, 21 Mar 2020 09:13:56 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:55 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 06/11] bisect--helper: retire `--next-all` subcommand Date: Sat, 21 Mar 2020 17:10:15 +0100 Message-Id: <20200321161020.22817-7-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 0534adf216..086ab8e46b 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] "), @@ -806,8 +805,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, @@ -820,8 +818,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, @@ -858,9 +854,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 Sat Mar 21 16:10:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451239 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 51A9E17E6 for ; Sat, 21 Mar 2020 16:14:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27D3F20776 for ; Sat, 21 Mar 2020 16:14:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uo933wxF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbgCUQOD (ORCPT ); Sat, 21 Mar 2020 12:14:03 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:37631 "EHLO mail-wr1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbgCUQOB (ORCPT ); Sat, 21 Mar 2020 12:14:01 -0400 Received: by mail-wr1-f50.google.com with SMTP id w10so11224250wrm.4 for ; Sat, 21 Mar 2020 09:13:58 -0700 (PDT) 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=9eqJLBXV29lnfhARMhQ0AIXLcesdgu4UCr0fKsqsXzU=; b=uo933wxFwWx+WIhZCcPWlKo5wAQixXukkXbORentB0mBQTdL1DVCBc1deNKp6Kmme0 EtosmxpO7cfASqKrYuXKGWQN4UAFnb+6V+xaQF0zZ1V3Ddwx7JGIQeXJjN6BKIwsm3+Y Aldev2Ax3bhQsGZp+yttza3YjcDmjUXMe4Whrnzg29gCDifYqEgvSoD2YWrH+5kGuSpo DfIRpxFgr9sdr3qhJPT4iQJFqlqyoCbE15mgkEKeLPHHAiH80WvCddAytnOtw+/9oR7e CuR/rr0gHYu52lPzQDLcKJ2Ii1BVu6TVxgYlCYhQtqy2xW1HggYHHN3yhXnT+dlqDTt7 WCjA== 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=9eqJLBXV29lnfhARMhQ0AIXLcesdgu4UCr0fKsqsXzU=; b=fnrCl3qyW5o4ua//90zjTeXwMXAymyjxfl+eAvKrvEQPFGzOnr1WJns7wd7mW+DFoP prK/kFuwvumQEpS8Ux3H61P3+6+VGOBSfYu5ZCROVhrBWRp2G5JHIcqixjUWGNXDtg7L pQhXIPuGr9ngsunmfJ2FO4iHXmlZhxAdJ8SKsykZA8HxMAGgJrF8pijvTD22LJTK+LS9 7bPeeuJrRQmRsHzL59HS5RVl4QzyHZAWRi2po1PZKRxFKmM5VGYGHlMgXxdtu96zOIZd O9Y3E5/eiDer9Fcx2ApSjkKvMmnV5++XWoEvF3FWjpD17qgPP9HztxCgsGNfjrKK0fC5 i4lw== X-Gm-Message-State: ANhLgQ015ZLpLri7WXrkY37vDdFfH36z4YgBRO2KVnaRyCvwL/cnMrSL +U1VHrVQkbHn+rO7gaM/qXErzLvP78Y= X-Google-Smtp-Source: ADFU+vtFQuesBfdu/SFKjSIiLQtt0GyjsxUdkk/Xout2/yuYTjj9aJgVIe7DuThM6MJjbb0CCHq8ag== X-Received: by 2002:adf:fc05:: with SMTP id i5mr18357770wrr.152.1584807237597; Sat, 21 Mar 2020 09:13:57 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:57 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 07/11] bisect--helper: reimplement `bisect_autostart` shell function in C Date: Sat, 21 Mar 2020 17:10:16 +0100 Message-Id: <20200321161020.22817-8-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 086ab8e46b..4496fd2228 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. @@ -554,6 +557,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; @@ -802,6 +806,32 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int no_checkou return res; } +static int bisect_autostart(struct bisect_terms *terms) +{ + const char *yesno; + + if (!is_empty_or_missing_file(git_path_bisect_start())) + return 0; + + 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, NULL, 0); +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -815,6 +845,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[] = { @@ -838,6 +869,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, @@ -904,6 +937,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: res = error(_("BUG: unknown subcommand.")); } 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 Sat Mar 21 16:10:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451241 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 2D479139A for ; Sat, 21 Mar 2020 16:14:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 040C320776 for ; Sat, 21 Mar 2020 16:14:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BpA4+nut" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727678AbgCUQOD (ORCPT ); Sat, 21 Mar 2020 12:14:03 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36426 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727232AbgCUQOB (ORCPT ); Sat, 21 Mar 2020 12:14:01 -0400 Received: by mail-wr1-f65.google.com with SMTP id 31so5201599wrs.3 for ; Sat, 21 Mar 2020 09:14:00 -0700 (PDT) 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=Uw5HR6e20M9HisL/8TO3lfinEm0oJVAz0kwptsk9L7A=; b=BpA4+nutTZtPkOUv9OOz4uwiA2YjUzXJJ8QYRyxwPe/7iD6r7/tx6n9E56jY89npIE bSxI9PB0buh8u53JOL3diDyUwCb1rR10UNY3Gcu+oezpZ8wogWvaEmQMMYWCjo2nBk8l uMuCuAHb4dTAm/1efDdsPXUPGP3aqUUdl9LgVaaSryg9NRqSca6SAEsHJv+RTBkHOzx4 fA3ZNfWLPAQhjwTvByfOHvJgGcCsMzNi1OQXFFdkkqKxawFlzQVZjWBKVBT8g/iWwRt3 jl4I8lDaSLucMd8doxELMsAWKa+2Cihmx1dQPdQjYl62g5F5JAkndc4tMCXlW4+hq8NQ 1ueQ== 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=Uw5HR6e20M9HisL/8TO3lfinEm0oJVAz0kwptsk9L7A=; b=OP+tNHmjgeWnS5w6IlCpCV8OtPiUXxDgwZXFW1xnS31q0JUdPxwHf3IA0zZdp1mvnu +fe6SBmNb3P6DiWr/X0R792JWAHHU6ulqSdJlF88MMTCgK8HuvphY8SC+unCZHTnXGW/ vm1anTLVz2lfwDPz/psZCwpomC8r9W9IMk0EIYTn9qiDpQHMNw5Ti6+grwcnKgSeClnI Qhg2oaczCaDYUNAPN+mZPSQscGjUKwsnn1vylyMro2OdxZEwmOXEs1n/t+etolY9fgym BvRBVQQ4a4k0t++K9dorQzv9CC8G+5N5RVgawOXtxmJEqslTn2OVMjeszgxI9JCsW3Z/ FWWA== X-Gm-Message-State: ANhLgQ0T+j/Dy8HvNsL8JV4cDoINiXDTS2WUGzmjh/wkdedLLSuCBncL iBkYWhWw9hkQPLFtYBmyFUAguVKB8qI= X-Google-Smtp-Source: ADFU+vuVlBSnWH2qTVDJO8L83TiRA8qgtbsF5GtitV88khlQp74XbGN9YNJXo/RRhvtxUcSw2cZOLA== X-Received: by 2002:a5d:468c:: with SMTP id u12mr3043870wrq.394.1584807238954; Sat, 21 Mar 2020 09:13:58 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:58 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 08/11] bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C Date: Sat, 21 Mar 2020 17:10:17 +0100 Message-Id: <20200321161020.22817-9-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 | 68 ++++++++++++++++++++++++++++++++++++++++ git-bisect.sh | 55 +++----------------------------- 2 files changed, 72 insertions(+), 51 deletions(-) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 4496fd2228..6364bd82c0 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 }; @@ -832,6 +834,64 @@ static int bisect_autostart(struct bisect_terms *terms) return bisect_start(terms, 0, NULL, 0); } +static int bisect_head(struct object_id *oid) +{ + if (is_empty_or_missing_file(git_path_bisect_head())) + return get_oid("HEAD", oid); + + return get_oid("BISECT_HEAD", oid); +} + +static enum bisect_error bisect_state(struct bisect_terms *terms, const char **argv, + int argc) +{ + const char *state; + const char *hex; + int i; + struct oid_array revs = OID_ARRAY_INIT; + struct object_id oid; + + if (!argc) + return error(_("Please call `--bisect-state` with at least one argument")); + state = argv[0]; + if (check_and_set_terms(terms, state) || + !one_of(state, terms->term_good,terms->term_bad, "skip", NULL)) + return BISECT_FAILED; + argv++; + argc--; + if (!strcmp(state, terms->term_bad) && (argc > 1)) + return error(_("'git bisect %s' can take only one argument."),terms->term_bad); + if (argc == 0) { + if (bisect_head(&oid)) + return error(_("Bad bisect_head rev input")); + hex = oid_to_hex(&oid); + if (bisect_write(state, hex, terms, 0)) + return BISECT_FAILED; + check_expected_revs(&hex, 1); + return bisect_auto_next(terms, NULL); + } + + /* Here argc > 0 */ + for (; argc; argc--, argv++) { + struct object_id oid; + if (get_oid(*argv, &oid)) + return error(_("Bad rev input: %s"), *argv); + oid_array_append(&revs, &oid); + } + + for (i = 0; i < revs.nr; i++) { + hex = oid_to_hex(&revs.oid[i]); + if (bisect_write(state, hex, terms, 0)) { + oid_array_clear(&revs); + return BISECT_FAILED; + } + check_expected_revs(&hex, 1); + } + + oid_array_clear(&revs); + return bisect_auto_next(terms, NULL); +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { @@ -846,6 +906,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[] = { @@ -871,6 +932,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, @@ -943,6 +1006,11 @@ 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: + set_terms(&terms, "bad", "good"); + get_terms(&terms); + res = bisect_state(&terms, argv, argc); + break; default: res = error(_("BUG: unknown subcommand.")); } diff --git a/git-bisect.sh b/git-bisect.sh index 049ffacdff..2da0810b1a 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 Sat Mar 21 16:10:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451237 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 959171864 for ; Sat, 21 Mar 2020 16:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7557E20788 for ; Sat, 21 Mar 2020 16:14:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zh5pEAA/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727689AbgCUQOE (ORCPT ); Sat, 21 Mar 2020 12:14:04 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36429 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbgCUQOC (ORCPT ); Sat, 21 Mar 2020 12:14:02 -0400 Received: by mail-wr1-f67.google.com with SMTP id 31so5201635wrs.3 for ; Sat, 21 Mar 2020 09:14:01 -0700 (PDT) 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=aC02Sl/m3KWl9+ff6g/7BAoajVhcCWSThhkZyC54V0I=; b=Zh5pEAA/ku6K5Yt+FgkBKwtiCeL9RObhrbYbxOgX8Kc04fDyTtrIzgsqnWUtolYeSP PYYf42GXZbBpICTHy3AV4i6gtczIgGBGjzB8Ax/g4iETSFinm1JVk1YamDWjZp+dtwPW t++McE/ugETMwzsSqHMvxJxIqtYrEHk8OExQLgzUffIY2TnDBqHuSehJrMvBnQS6C4fs eQY+P21avl0fc1UTCja7qn8KN1qgfcvncc8PwUOt8BqSrpZ29LBjkIjsGT84ILVHfBAI SsguVyfOd3Yq9xqUK6CbfmgNOTum55s+Dkm0jTAyqO7ZmHdpRqE0vDiOrAATFSx3qdGj SU0w== 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=aC02Sl/m3KWl9+ff6g/7BAoajVhcCWSThhkZyC54V0I=; b=OoJhyzstMfyb1CrSqFpSHYGxA8zRKUjcDr5ht43Nu4z+htASQZQSuqgV49EXbs4Jx4 GlA9Wi/Tvs2/9svLWdSHrYO3RwDCGQyua8jITGOMFJrix+ceKlEaCil4qgUvFw2V3aV2 mBw90tk0UtjYzcFG36hEOQhN6ZJaP1wAJlCsRXRC8FU+zWP+LH2vBGQChSf+scPs1br3 fdo4ADOM9j8rgIEz/Z3AJxrRNSP/oLk0W/zMnTj8D7AP3WaLAhFK6GOT8e5ok10tgi7o STyhqAe8MxyjGiXH4O/H396OIZTZ5XP6HiyfXwPWPAWWpGTtokiSMMVUeDbCHktgOJtj pf6g== X-Gm-Message-State: ANhLgQ2EGSlhXpwl5OGT4MR0Yz5RDUNvt/p9HW53d/rx3uOw6G+ipy/w rNCRlDxL3N19obaBVX/DzS8ShSv+TCg= X-Google-Smtp-Source: ADFU+vvIdOzFFByVSOkKvl4lAu3V4Vz71/HuuDAoZ/ZDAbI91AVN3pcIyzFuFx1FhYzsmJw+Sasaag== X-Received: by 2002:a5d:4104:: with SMTP id l4mr19357338wrp.55.1584807240367; Sat, 21 Mar 2020 09:14:00 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.13.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:13:59 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 09/11] bisect--helper: retire `--check-expected-revs` subcommand Date: Sat, 21 Mar 2020 17:10:18 +0100 Message-Id: <20200321161020.22817-10-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 6364bd82c0..2b1d918497 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -896,7 +896,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, @@ -912,8 +911,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, @@ -954,9 +951,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 Sat Mar 21 16:10:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Miriam R." X-Patchwork-Id: 11451235 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 6C55A139A for ; Sat, 21 Mar 2020 16:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C41B20781 for ; Sat, 21 Mar 2020 16:14:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H7BvfG/T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727700AbgCUQOF (ORCPT ); Sat, 21 Mar 2020 12:14:05 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43121 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727664AbgCUQOD (ORCPT ); Sat, 21 Mar 2020 12:14:03 -0400 Received: by mail-wr1-f65.google.com with SMTP id b2so11184769wrj.10 for ; Sat, 21 Mar 2020 09:14:02 -0700 (PDT) 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=twYGXXJepqFNADUAJI94HOwQKJkYuQPF9Hhrv9JgPBk=; b=H7BvfG/TyEtR1J6zCDMfC9Avv6f/keljGJuT314GkR0S1bFTqMT0sWFIZGAi8vROhg /8OP5tYt4QTBZvboi98HVYyTr+LaqVYonO010SPLDqip/l2mdihAuEn31Id1+Td8iUJK cOhRmbrIpc02YuIt2Mei7djiZganCzppskXzZ47vkUNRyuIUXtuJYDxNazKlg0Pm0Fbq dYP3lhx48k/N/esmAZMHUzg4BjC5T+fQ8+se/ELVBXFBB567dgCDufmc5CYnEEcizxJn w+q/mvj13ewjXhZXhXdLCihJqEJubIW+Mi1U2YJhSpeHwpeGv0fGgpRFw0BOUTFhfCAX 8IWw== 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=twYGXXJepqFNADUAJI94HOwQKJkYuQPF9Hhrv9JgPBk=; b=RoYd0Kr+Z/eRShgXKRRchYcEHXPmm6QzArCbeGYmV7Mew74c0jqvqqU290sDGduX/o QFB6zaG6KAq4C2aNsuwvUjdZNz5VKQG9U56Ydie2yikJlBri9n/OxR2DO2RUXSv+iN9/ feKfOXJnlunRsPllF6Q/02BB7mS+wxoSxwlhBiQJdfct4+mpNs4KTJwCbicAMhuBJgcH APWmIipdvSnnB9vCMx+XinoGHcdd5RFc7IBCtngxULYwIlQPA3XGQzftaTd84BQGRCDv +/JQAYQL1HPqDuh30JAwfs0eRFMYMEuk+m1QnGUrFN/H8JdUtuTm7otsvp26DzopyF4s gxRg== X-Gm-Message-State: ANhLgQ3XK2hBvn+pUIzSvaJwodqz1BnK/In4wVO8T1ol1hii7qzlGOTx 6xQISjVCHEfwh+b2gHaf3h1BRxlhKi0= X-Google-Smtp-Source: ADFU+vvY6ETii5/tXsppc++MvcoENENuUHqCPogWFNKJJUvU8GmAeASe1niHz6Pg9I/Y/MmiW2VHDQ== X-Received: by 2002:adf:a285:: with SMTP id s5mr19081410wra.118.1584807241725; Sat, 21 Mar 2020 09:14:01 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.14.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:14:01 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 10/11] bisect--helper: retire `--write-terms` subcommand Date: Sat, 21 Mar 2020 17:10:19 +0100 Message-Id: <20200321161020.22817-11-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 2b1d918497..8fdefb611b 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 "), @@ -895,8 +894,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, @@ -909,8 +907,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, @@ -947,10 +943,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 Sat Mar 21 16:10: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: 11451243 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 F1481139A for ; Sat, 21 Mar 2020 16:14:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFBF620757 for ; Sat, 21 Mar 2020 16:14:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PCAS0FvD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727705AbgCUQOI (ORCPT ); Sat, 21 Mar 2020 12:14:08 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36433 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbgCUQOE (ORCPT ); Sat, 21 Mar 2020 12:14:04 -0400 Received: by mail-wr1-f66.google.com with SMTP id 31so5201731wrs.3 for ; Sat, 21 Mar 2020 09:14:04 -0700 (PDT) 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=+ogHLIRJ+uR2baoE9reT+pIo+zIlr9lDLtDPV+i8uiA=; b=PCAS0FvDI1YqJxDb0LQKBX+5mXg9kFl1gKfn0epU0z8UcvqVPTP7UUOLWiuCkJoJeX 7SKWerj4XEL14o9O4iz9MF2cNhtXVeIGoc8OsXp0aZr4b5mBekSDansKKOGrkvXc8GAM 9EqmMxEYJInNJGpqfePvKE5lA379TvwbFWo/p0xCRwVv7xRn09mw8lB9P3mCMMyKsYem f253i1cPFf6hRLZfZXRr0rmWGpb9tuOhjM+utbCnVndgeYo29k/EUIfceJIDaZHtfODr KhxtQ++pkfv3oemwYgtmHXyEdxfEQAGShyzuJsvgKyYXMS4i6pDWhsHVLc5HLAckAiHM 7vlg== 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=+ogHLIRJ+uR2baoE9reT+pIo+zIlr9lDLtDPV+i8uiA=; b=svG1r6s6SqNak/XFgrHK11vvs8ExXuOkvLuE0yujlv9nh4rWAjWj3WRmgY0AJuesw/ +cGr7xabunZDmaPbkWKtJf07MuuoxuUqKNTzVPmF+WgztDWILNRSbbuOU3LpGij0mrUi uxPUjMRm/pHysi7PCMNeo8AewbgiAKmiLbgxBQtF71HuJ83h1hD4F3r1kD89tJ6GISz9 zHt0ZFVOPuqcdTGlhElESlpqR0jR1ryX6eEIWB78+iWAMty+GsDFl07p90QGY4muEJ0p v+wb8AI/+6HCnRIK32QrcWSWCelaNEWw/neIrBTi2l1OUA71NPripuq5OK/hbjdzyvI1 tn1A== X-Gm-Message-State: ANhLgQ3o259npDaIE6DfOF5DRequqLrR6YGwvTWE3Q/BrsAmBPPEvNT9 E8KP5JrdhYYumtyCTpCvAqe3O2fh+w0= X-Google-Smtp-Source: ADFU+vuX4u9vndpjVRnhUj4UHuA+WY3K1Pj49pByMxkgjFufAalMCIqIDBAFb+ChcS1cE9ceoBIOGw== X-Received: by 2002:adf:f841:: with SMTP id d1mr19232100wrq.77.1584807243144; Sat, 21 Mar 2020 09:14:03 -0700 (PDT) Received: from localhost.localdomain ([139.47.115.4]) by smtp.gmail.com with ESMTPSA id f22sm13992285wmf.2.2020.03.21.09.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2020 09:14:02 -0700 (PDT) From: Miriam Rubio To: git@vger.kernel.org Cc: Pranit Bauva , Lars Schneider , Christian Couder , Johannes Schindelin , Tanushree Tumane , Miriam Rubio Subject: [PATCH v2 11/11] bisect--helper: retire `--bisect-autostart` subcommand Date: Sat, 21 Mar 2020 17:10:20 +0100 Message-Id: <20200321161020.22817-12-mirucam@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200321161020.22817-1-mirucam@gmail.com> References: <20200321161020.22817-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 8fdefb611b..d3ec926ae4 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 @@ -902,7 +901,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; @@ -923,8 +921,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, @@ -986,12 +982,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: set_terms(&terms, "bad", "good"); get_terms(&terms);