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

Re: Allow git bisect to auto-skip

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 27, 2024, 19:24 UTC
Message-ID
<xmqqfrwb1nr8.fsf@gitster.g>
In-Reply-To
<7556a3de-a6a6-4284-8c36-3635ae43c653@schinagl.nl>
Olliver Schinagl <oliver@schinagl.nl> writes:
Show 5 quoted lines
> 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-*`).

I think it is very unlikely that we'd adopt any hardcoded scheme that allows only one supported way of marking commits as not to be tested. Certainly not the kind that the committer is forced to know the commit must be skipped during a bisection session before creating the commit. So I am not sure how much good it will do to know that commit_list->item is a commit object on the list, or calling repo_get_commit_buffer() on it would give the contents of the commit object.

Knowing that commit_list->item->object.oid is the object name of such a commit, and calling oid_to_hex() on such an object name stringifies it, should be sufficient to write a new code that calls out to a script specified via "git bisect --skip-when=<script>" using the run_command() API to decide if the commit object should be skipped, and if you do want GIT_BISECT_SKIP=1 in the log message, your script given via --skip-when may be a single-liner:

    #!/bin/sh
    # usage: this-script $commit_object_name
    # expected to exit with 0 when the commit should not be tested
    git cat-file commit "$1" | sed -e '1,/^$/d' | grep GIT_BISECT_SKIP=1
Thanks.
Previous: Olliver SchinaglNext: Olliver Schinagl
Message 13 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.