public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <christian.couder@gmail.com>
Cc: Begad Habib <begadhabib989@gmail.com>,  git@vger.kernel.org
Subject: Re: Possible git bisect behavior issue when skipping commits
Date: Mon, 21 Jul 2025 10:03:52 -0700	[thread overview]
Message-ID: <xmqqa54xzdaf.fsf@gitster.g> (raw)
In-Reply-To: <CAP8UFD1bwe92zbXHWe-LiMSJZtcTJQwi9mtgNCm-_kTeyFk08w@mail.gmail.com> (Christian Couder's message of "Sun, 20 Jul 2025 10:34:12 +0200")

Christian Couder <christian.couder@gmail.com> writes:

>> # Commit 1 – good
>> echo "good" > file.txt
>> git add file.txt
>> git commit -m "Commit 1 - good"
>>
>> # Commit 2 – skipped
>> echo "middle" > file.txt
>> git add file.txt
>> git commit -m "Commit 2 - middle"
>>
>> # Commit 3 – bad
>> echo "bad" > file.txt
>> git add file.txt
>> git commit -m "Commit 3 - bad"
>>
>> # Start bisect
>> git bisect start
>> git bisect bad
>> git bisect good HEAD~2
>
> When both one "good" and one "bad" commits have been specified, then
> Git starts bisecting, which means that you should then see something
> like:
>
> Bisecting: 0 revisions left to test after this (roughly 0 steps)
> [df357f37981b7f1e804684cc09842d02fd012146] Commit 2 - middle
>
> and Git should have checked out "Commit 2 - middle", so HEAD should
> point to that commit.
>
> By the way it could help if you could show git's output when giving
> steps to reproduce like this.
>
>> git bisect skip HEAD~1
>
> This will "skip" the commit before the current one, so "Commit 1 -
> good", which is already marked as "good".

Good eyes.  I missed that "HEAD~1 no longer means the second one at
that point because you gave both bad and good already", which you
correctly identified as the root cause of the confusion.  The user
thought #2 is marked to be skipped, but in reality #1 that is good
is marked for skipping, which would result in nonsensical output, as
the final output phase assumes that all skipped ones haven't been
even tested.

Avoid this (I am not saying we should implement such a safety
measure, at least not yet) would involve "Are you sure?  You've
already said X is A but now you are saying it is B" confirmation
when "git bisect {good,bad,skip}" is used on a commit that the user
already said something about.  Allowing them to change their mind is
a good feature.  We'd need to make consistent changes.  For example,
when we create refs/bisect/bad, we should check if we already have
refs/bisect/good-* that points at the same commit (and vice versa)
to make sure we do not mark the same commit as both good and bad.
The same thing can be said about "refs/bisect/skip-*".

This is a tangent, but do we forbid using the word "skip" as a
customized term for "good"?  If we are not, we probably should.

Thanks.




      reply	other threads:[~2025-07-21 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-19 15:31 Possible git bisect behavior issue when skipping commits Begad Habib
2025-07-20  1:12 ` Junio C Hamano
2025-07-20  8:34 ` Christian Couder
2025-07-21 17:03   ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa54xzdaf.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=begadhabib989@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox