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

Re: Allow git bisect to auto-skip

From
Olliver Schinagl <oliver@schinagl.nl>
Date
Mar 27, 2024, 18:33 UTC
Message-ID
<7556a3de-a6a6-4284-8c36-3635ae43c653@schinagl.nl>
In-Reply-To
<xmqq8r27sclp.fsf@gitster.g>
On 24-03-2024 19:34, Junio C Hamano wrote:
Show 16 quoted lines
> Christian Couder <christian.couder@gmail.com> writes:
> 
>> Also, how much better would this be compared to tracking  "git bisect
>> run" scripts in the repo, even if they have to be copied somewhere
>> else before they are launched? I wonder about this because writing the
>> conditions that decide whether the current commit is good or bad might
>> not be so easy either. So if the goal is to simplify things for users,
>> then simplifying all the way by providing example scripts with
>> comments about how they could be customized might be even better.
> 
> If we are driving our bisection session via "bisect run" script,
> computing the condition that we need to skip in the script is the
> most natural and obvious thing to do, but the way I guessed (because
> it was not explicitly written down) what the OP wanted was a way for
> bisect_next() called after even a manual "git bisect (good|bad)" to
> automatically skip certain set of commits.
I think you understood what I failed to properly explain :)

To come up with an RFC, I was trying to study the git code, and while some things are quite readable, others are a bit complex.

After some poking, I was thinking of using `find_bisection()`, or rather `do_find_bisection()` but got lost there.

What made sense initially was, that in `find_bisection()` there is a simple for loop that goes over the list of commits to count them. But writing this down, I realize the list of commits is already there in `struct commit_list *list`, so I should probably go find out where the list is being created!

Anyway, want I was thinking of, based a key somewhere in the message body (GIT_BISECT_SKIP=1 for example), mark the commit in the list to be skipped, as `git bisect skip` would. This so the skipped commit actualyl ends up on the list of skipped commits (`refs/bisect/skip-*`).

But being a bit lost, it would be nice to get some directional pointers.

Is this even possible? What is the easiest way to get the message from the `struct commit_list *list` item, are there helpers to parse the message at all?

Thanks, Olliver

Show 27 quoted lines
>  Because there are cases
> where you have to be testing manually and cannot afford to write
> "bisect run" script, giving a manual bisection a way to compute if a
> commit need to be skipped may be worth having, and that was where my
> "git bisect --skip-when <script>" came from.  It would not be
> necessary if you are doing "bisect run", which can dynamically tell
> if the commit is untestable.  And if the user is going to decide
> after manually testing the one that is suggested, it is not useful
> either, as the point would be to avoid even asking to test ones that
> need to be skipped.  So it is likely that the set of commits that
> need skipping is known a-priori before the bisect session even
> begins.  The end user experience may look like:
> 
>   * "git bisect start" takes "--skip-when <script>" and remembers it,
>     together with other options "start" can take (like <good>, <bad>,
>     <terms>, <pathspec>).
> 
>   - If <good> and <bad> are already given upon "start", the command
>     may check out a revision and ask you to test.
> 
>   * Every time the command checks out a revision to be tested by the
>     user, the command guarantees if it satisfies the --skip-when
>     condition (and internally doing "git bisect skip").
> 
>   * Otherwise the interaction between the user and the session is
>     exactly the same as usual.
> 
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 of 14 in “Allow git bisect to auto-skip”
  1. Olliver SchinaglMar 22, 2024
  2. Junio C HamanoMar 22, 2024
  3. Olliver SchinaglMar 23, 2024
  4. Stefan HallerMar 23, 2024
  5. Junio C HamanoMar 23, 2024
  6. Olliver SchinaglMar 23, 2024
  7. Olliver SchinaglMar 24, 2024
  8. Stefan HallerMar 24, 2024
  9. Christian CouderMar 24, 2024
  10. rsbecker@nexbridge.comMar 24, 2024
  11. Junio C HamanoMar 24, 2024
  12. Olliver SchinaglMar 27, 2024
  13. Junio C HamanoMar 27, 2024
  14. Olliver SchinaglMar 28, 2024

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.