From: TANUSHREE TUMANE Date: Mon, 07 Jan 2019 09:15:45 GMT Subject: Re: [PATCH v17 0/7] git bisect: convert from shell to C Message-ID: In-Reply-To: Yes, you are right. I will revert this back. On Fri, Jan 4, 2019 at 8:08 PM Ramsay Jones wrote: > > > > On 02/01/2019 15:38, Tanushree Tumane via GitGitGadget wrote: > [snip] > > base-commit: 7f4e64169352e03476b0ea64e7e2973669e491a2 > > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-101%2Ftanushree27%2Fgit-bisect_part2_fixup-v17 > > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-101/tanushree27/git-bisect_part2_fixup-v17 > > Pull-Request: https://github.com/gitgitgadget/git/pull/101 > > I didn't look at the patches, only the range-diff below, and the > only thing I noticed was ... > > > > > Range-diff vs v16: > > > > 1: f1e89ba517 ! 1: 338ebdc97a bisect--helper: `bisect_reset` shell function in C > > @@ -16,8 +16,9 @@ > > > > Mentored-by: Lars Schneider > > Mentored-by: Christian Couder > > + Mentored by: Johannes Schindelin > > Signed-off-by: Pranit Bauva > > - Signed-off-by: Junio C Hamano > > + Signed-off-by: Tanushree Tumane > > > > diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c > > --- a/builtin/bisect--helper.c > > @@ -53,8 +54,10 @@ > > + struct strbuf branch = STRBUF_INIT; > > + > > + if (!commit) { > > -+ if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) > > -+ return !printf(_("We are not bisecting.\n")); > > ++ if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) { > > ++ printf(_("We are not bisecting.\n")); > > ++ return 0; > > ++ } > > + strbuf_rtrim(&branch); > > + } else { > > + struct object_id oid; > > @@ -69,11 +72,11 @@ > > + > > + 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 '."), branch.buf); > > + strbuf_release(&branch); > > + argv_array_clear(&argv); > > -+ return -1; > > ++ return error(_("could not check out original" > > ++ " HEAD '%s'. Try 'git bisect" > > ++ "reset '."), branch.buf); > > ... this 'branch.buf' will refer to the empty 'slopbuf', since > the call to 'strbuf_release(&branch)' now precedes this call > to error(). > > ATB, > Ramsay Jones >