From: SZEDER Gábor Date: Fri, 16 Feb 2018 01:22:43 GMT Subject: Re: [PATCH v16 Part II 7/8] bisect--helper: `bisect_start` shell function partially in C Message-ID: <20180216012243.14169-1-szeder.dev@gmail.com> In-Reply-To: <0102015f5e5ee2f5-3d106a61-7f79-4973-851f-f55a691a6189-000000@eu-west-1.amazonses.com> > diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c > index ab0580ce0089a..4ac175c49e80c 100644 > --- a/builtin/bisect--helper.c > +++ b/builtin/bisect--helper.c > + /* > + * Check if we are bisecting > + */ > + if (!is_empty_or_missing_file(git_path_bisect_start())) { > + /* Reset to the rev from where we started */ > + strbuf_read_file(&start_head, git_path_bisect_start(), 0); > + strbuf_trim(&start_head); > + if (!no_checkout) { > + struct argv_array argv = ARGV_ARRAY_INIT; > + > + argv_array_pushl(&argv, "checkout", start_head.buf, > + "--", NULL); > + if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) { > + error(_("checking out '%s' failed. Try 'git " > + "bisect start '."), > + start_head.buf); > + goto fail; > + } > + } > + } else { > + /* Get the rev from where we start. */ > + if (!get_oid(head, &head_oid) && > + !starts_with(head, "refs/heads/")) { > + strbuf_reset(&start_head); > + strbuf_addstr(&start_head, sha1_to_hex(head_oid.hash)); Please use oid_to_hex(&head_oid) instead of sha1_to_hex().