On Wed, Jun 15, 2016 at 10:00 AM, Pranit Bauva <pranit.bauva@xxxxxxxxx> wrote: > Reimplement `bisect_reset` shell function in C and add a `--bisect-reset` > subcommand to `git bisect--helper` to call it from git-bisect.sh . > [...] > Signed-off-by: Pranit Bauva <pranit.bauva@xxxxxxxxx> > --- > diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c > @@ -123,12 +127,48 @@ static int bisect_clean_state(void) > +static int bisect_reset(const char *commit) > +{ > + struct strbuf branch = STRBUF_INIT; > + > + if (!commit) { > + if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) { > + printf("We are not bisecting.\n"); > + return 0; > + } > + strbuf_rtrim(&branch); > + Style: unnecessary blank line > + } else { > + struct object_id oid; > + if (get_oid(commit, &oid)) > + return error(_("'%s' is not a valid commit"), commit); > + strbuf_addf(&branch, "%s", commit); strbuf_addstr(&branch, commit); > + } > + > + if (!file_exists(git_path_bisect_head())) { > + struct argv_array argv = ARGV_ARRAY_INIT; > + argv_array_pushl(&argv, "checkout", branch.buf, "--", NULL); > + if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) { > + error(_("Could not check out original HEAD '%s'. Try" > + "'git bisect reset <commit>'."), branch.buf); > + strbuf_release(&branch); > + argv_array_clear(&argv); > + return -1; > + } > + argv_array_clear(&argv); > + } > + > + strbuf_release(&branch); > + return bisect_clean_state(); > +} -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html