Re: [PATCH v17 0/7] git bisect: convert from shell to C
From: Ramsay Jones <hidden>
Date: 2019-01-03 01:19:33
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 [off-list ref]
Mentored-by: Christian Couder [off-list ref]
+ Mentored by: Johannes Schindelin [off-list ref]
Signed-off-by: Pranit Bauva [off-list ref]
- Signed-off-by: Junio C Hamano [off-list ref]
+ Signed-off-by: Tanushree Tumane [off-list ref]
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 <commit>'."), branch.buf);
+ strbuf_release(&branch);
+ argv_array_clear(&argv);
-+ return -1;
++ return error(_("could not check out original"
++ " HEAD '%s'. Try 'git bisect"
++ "reset <commit>'."), 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