Subject: Re: [PATCH v16 Part II 7/8] bisect--helper: `bisect_start` shell function partially in C

From: SZEDER Gábor <[email-masked]>
Date: Fri, 16 Feb 2018 02:22:43 +0100

> 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 <valid-branch>'."),
> +				      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().