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

Re: [PATCH] bisect--helper: warn if we are assuming an unlikely pathspec

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2022, 06:22 UTC
Message-ID
<xmqqv8uo1mk6.fsf@gitster.g>
In-Reply-To
<48cd2ce4-feac-b028-daad-2df6aa71e363@gmail.com>
Bagas Sanjaya <bagasdotme@gmail.com> writes:
Show 12 quoted lines
> 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?
Previous: Bagas SanjayaNext: Chris Down
Message 3 of 4 in “bisect--helper: warn if we are assuming an unlikely pathspec”
  1. bisect--helper: warn if we are assuming an unlikely pathspecChris Down, May 1, 2022
  2. Bagas SanjayaMay 2, 2022
  3. Junio C HamanoMay 2, 2022
  4. Chris DownMay 3, 2022

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.