git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git bisect start fails when stale bisect data is left behind

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 6, 2011, 16:38 UTC
Message-ID
<7vehztaan4.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAP8UFD1h059dOyjszcP-qFauyho78c0RHBMQsGOPFgzZtp+7vg@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 21 quoted lines
>> How to reproduce:
>> $ echo foo > .git/BISECT_START
>> $ git bisect start HEAD HEAD^
>>
>> Fails with "fatal: invalid reference:" on git 1.7.6.
>
> Yeah, it looks like a very old behavior.
> I'd suggest a simple improvement in the error message like this:
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index c21e33c..bd7155b 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -67,7 +67,8 @@ bisect_start() {
>         then
>                 # Reset to the rev from where we started.
>                 start_head=$(cat "$GIT_DIR/BISECT_START")
> -               git checkout "$start_head" -- || exit
> +               git checkout "$start_head" -- ||
> +               die "Could not checkout previous start point
> '$start_head'. Try 'git bisect reset <branch>' first."

I do not necessarily think this is a bug to begin with --- the user had a bad state, and bisect stopped without doing further damage.

The real question is what the sensible suggestion/advice the new message should give. It would have to involve bisect reset in the end to get rid of the stale bisect state, but wouldn't the user potentially lose some other state if s/he blindly followed the die message's suggestion and ran "bisect reset"?

Previous: Christian CouderNext: Christian Couder
Message 3 of 6 in “[BUG] git bisect start fails when stale bisect data is left behind”
  1. Joel KaasinenSep 5, 2011
  2. Christian CouderSep 6, 2011
  3. Junio C HamanoSep 6, 2011
  4. Christian CouderSep 7, 2011
  5. Joel KaasinenSep 7, 2011
  6. Junio C HamanoSep 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.