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

Re: [RFC] bisect: Introduce skip-when to automatically skip commits

From
Olliver Schinagl <oliver@schinagl.nl>
Date
Apr 6, 2024, 19:17 UTC
Message-ID
<6dd4a5a4-9999-4c04-a854-09fc238c91bb@schinagl.nl>
In-Reply-To
<4bedcad2-218a-4b16-88a7-cc70cc126af3@gmail.com>
Hey Phillip,
On 06-04-2024 15:50, Phillip Wood wrote:
Show 32 quoted lines
> Hi Olliver
> 
> On 06/04/2024 11:06, Olliver Schinagl wrote:
>> On 06-04-2024 03:08, Junio C Hamano wrote:
>>> Olliver Schinagl <oliver@schinagl.nl> writes:
>>>
>>>> Hey all,
>>>>
>>>> I've also got my work on a branch in my repo, if that helps to look at
>>>> things, https://gitlab.com/olliver/git/-/tree/skip_bisect
>>>>
>>>> Also included is a script to be used as an example. I opted to use
>>>> `git show`, which is nice because it works both on commits, but also
>>>> on notes.
>>>>
>>>> Anyway, any thoughts on the bellow before I send the full series?
>>>>
>>>> Olliver
>>>
>>> I would not write get_skip_when() before studying the same file to
>>> see if there already is a helper to read the whole file used in the
>>> vicinity (like strbuf_read_file(), perhaps).
>>
>> Fair enough. I'm a little worried about optimization vs readability. I 
>> think it makes it mre clear what the code does in its current form; 
>> but I'll investigate. Bisecting shouldn't be a computational often 
>> happening thing, so I'm not to worried about performance. But I'm not 
>> too familiar with the git code base, so I don't know either :p
> 
> If you search builtin/bisect.c you'll see some existing callers of 
> strbuf_read_file() that read other files like BISECT_START. Those 
> callers should give you an idea of how to use it.

Yeah, I found after Junio's hint :) What threw me off, as I wrote earlier, get_terms(). I wonder now, why is get_terms() implemented as it is, and should it not use the same functions? Or is it because terms is a multi-line file, whereas the others are all single line (I didn't look, though I see addline functions for the strbuf functions. Should this be refactored?

Show 11 quoted lines
> 
>>>
>>> I do not have enough concentration to follow changes to
>>> bisect_auto_next() is reasonable.  Especially I do not know why
>>> "bisect-skip_when" wants to exist and what it is trying to do,
>>> besides the fact that its name looks horrible ;-).
>>>
>> naming things, sure. I can look into this absolutly :)
> 
> For me it's not just the name but the whole hook thing - do we really 
> need that rather than just the command line option?

So with the name, I started to think some more about it, and after playing with some names, I settled on 'bisect-post-checkout'. Things then sort of fell more into place. It is still a hook/commandline option, but it's a much smaller change (since we don't have any special code to check the exit code anymore) as we can (obviously) run `git bisect skip` instead of `exit 125` as well of course. The `exit 125` thinking came from `git bisect run` and maybe a suggestion on the ML earlier (I don't quite recall).

Show 10 quoted lines
> 
> The other thing I wondered about is the exit code handling for the 
> "--skip-when" script. In Junio's example in an earlier message he used a 
> successful exit to mean "skip this commit" and an unsuccessful exit to 
> mean "test this commit". To me that matches the name of the option - we 
> skip when the script given to "--skip-when" is successful. Copying the 
> mechanism used by "git bisect run" seems a bit cumbersome as we only 
> need to know whether to skip or not, we don't need a special way of 
> distinguishing "skip this commit" from "this commit is good" and "this 
> commit is bad"

So as I explained above, I think just offering a 'post-checkout' step, and let the user decide what to do there, makes things even simpler and more flexible.

I've just pushed my latest changes to https://gitlab.com/olliver/git/-/commit/4361a5deb0c5ee4c113c25b57752af61b74aabf3 and will start working on some tests before offering it for review again.

Thank you!
Olliver
Show 19 quoted lines
> 
> Best Wishes
> 
> Phillip
> 
>> But in short, bisect_auto_next was returning just after checkout It 
>> seemed. So after checkout, running the script seemed sensible. But I 
>> look at it as a normal git user. So you checkout, test your commit, 
>> skip to the next one if applicable.
>>
>>
>> I'll think of your two comments, and see if I can address them as you 
>> regain your concentration :p
>>
>> But seeing that these are your main concerns, I'm more confident I'm 
>> not completly on the wrong path here.
>>
>> Olliver
>>
Previous: Phillip WoodNext: phillip.wood123@gmail.com
Message 6 of 20 in “[RFC] bisect: Introduce skip-when to automatically skip commits”
  1. Olliver SchinaglMar 30, 2024
  2. Olliver SchinaglApr 5, 2024
  3. Junio C HamanoApr 6, 2024
  4. Olliver SchinaglApr 6, 2024
  5. Phillip WoodApr 6, 2024
  6. Olliver SchinaglApr 6, 2024
  7. phillip.wood123@gmail.comApr 7, 2024
  8. Olliver SchinaglApr 7, 2024
  9. phillip.wood123@gmail.comApr 7, 2024
  10. Olliver SchinaglApr 7, 2024
  11. Junio C HamanoApr 8, 2024
  12. Olliver SchinaglApr 10, 2024
  13. Junio C HamanoApr 10, 2024
  14. Olliver SchinaglApr 10, 2024
  15. Junio C HamanoApr 10, 2024
  16. Olliver SchinaglApr 10, 2024
  17. Phillip WoodApr 12, 2024
  18. Junio C HamanoApr 6, 2024
  19. Olliver SchinaglApr 6, 2024
  20. Olliver SchinaglApr 6, 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.