git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Chris Down <chris@chrisdown.name>,
	git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] bisect--helper: warn if we are assuming an unlikely pathspec
Date: Sun, 01 May 2022 23:22:01 -0700	[thread overview]
Message-ID: <xmqqv8uo1mk6.fsf@gitster.g> (raw)
In-Reply-To: <48cd2ce4-feac-b028-daad-2df6aa71e363@gmail.com> (Bagas Sanjaya's message of "Mon, 2 May 2022 12:50:57 +0700")

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> On 5/1/22 19:29, Chris Down wrote:
>> In order to avoid this, emit a warning when we are assuming an argument
>> is a pathspec, but no such path exists in the checkout and this doesn't
>> look like a pathspec according to looks_like_pathspec:
>> 
>>     $ git bisect start d93ff48803f0 v6.3
>>     warning: assuming 'v6.3' is a path
>>     $
>> 
>
> For completeness, we can say 'If this is incorrect, abort the current
> bisection with "git bisect reset" and rerun with correct commit-ish.'.

We certainly can, but I am not sure how much it helps.

Even though I understand that the original end-user confusion
happened to come from taking what the user thought was a revision as
pathspec, I think it is a mistake to build the "warning" UI around
it.

Stepping back a bit, there are "git bisect" invocations that compute
and check out the commit to be tested, and there are "git bisect"
invocations that only advance the internal state a bit but not yet
become ready to offer the first commit to be tested.  The problem in
the current UI is that we are fairly chatty once we start bisecting,
but until we receive enough information to start bisecting, we are
fairly silent.

Even if the user did not use the lazy short-hand form of "bisect
start" with bad and good commits at all, after saying "git bisect
good <X>" (read: it is a state that made a bit of progress but still
not ready, because the command wants to see at least one bad commit,
too), wouldn't it be nice if the user is told what state the command
is in?  Perhaps we can give some feedback _before_ we are ready to
compute bisection?

A model dialogue may go like this.

    $ git bisect start -- bin/
    info: bisect waiting for good and bad commits.
    $ git bisect good master
    info: bisect waiting for a bad commit, one good commit known.
    $ git bisect good maint
    info: bisect waiting for a bad commit, two good commits known.
    $ git bisect bad next
    Bisecting: ...

Then the exchange for the lazy short-hand form of "bisect start"
would fall out quite naturally.

    $ git bisect start d93ff48803f0 -- v6.3
    info: bisect waiting for a good commit, one bad commit known.

For a bonus point, we may want to also say something on these
"info:" lines that we were given a pathspec.

It would also be a good idea to add a new subcommand "git bisect status"
to recompute the state (i.e. what it is waiting for and what it
already knows) when the user forgets, which can happen quite often.

With such a bonus feature, the exchange might go like this:

    $ git bisect start seen
    info: bisect waiting for a good commit, a bad commit known.
    $ git reset --hard maint ;# choose an older point, hoping it is good.
    $ make test
    ... pages of output scrolls the "info:" out of window ...
    $ git bisect status
    info: bisect waiting for a good commit, a bad commit known.
    $ git bisect bad maint
    info: bisect waiting for a good commit, a bad commit known.
    $ git reset --hard v1.0 ;# an even older point, hoping it is good.
    $ make test
    ... again pages of output ...
    $ git bisect good v1.0
    Bisecting ...

Hmm?

  reply	other threads:[~2022-05-02  6:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-01 12:29 [PATCH] bisect--helper: warn if we are assuming an unlikely pathspec Chris Down
2022-05-02  5:50 ` Bagas Sanjaya
2022-05-02  6:22   ` Junio C Hamano [this message]
2022-05-03 18:51     ` Chris Down

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=xmqqv8uo1mk6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=bagasdotme@gmail.com \
    --cc=chris@chrisdown.name \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).