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

Re: [RFC 0/9] bisect: allow git bisect to be used with repos containing damaged trees.

From
Jon Seymour <jon.seymour@gmail.com>
Date
Jul 25, 2011, 23:27 UTC
Message-ID
<CAH3Anrrq8xiYVwM-U6OMX7834ey_BxWBXj97bqWA=u8PZ2shjA@mail.gmail.com>
In-Reply-To
<7vhb6arzvj.fsf@alter.siamese.dyndns.org>
On Tue, Jul 26, 2011 at 4:14 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Jon Seymour <jon.seymour@gmail.com> writes:
>
>> I don't think you understood my intention. Suppose, I have
>>
>> B4 - B5 - B6' - B7' - B8' - B9
>>
>> such that B6 and B7 and B8 all contain a damaged tree, but B4, B5 and B9 don't
>> since it contains a different tree, then:
>
> What prevents your disk from corrupting a blob that was in B6, modified by
> commit B7, and then _reverted_ by commit B8? Then your checkout would fail
> at B6 and B8 but B7 will be fine.
But that's ok.

If B7's tree is fine, then the tree at B7 (if not the exact history leading to the tree) can be recovered by suitable grafts.

Also, the intent was not to use failure of git checkout as the test - the intent was merely to prevent a failure of git checkout from progressing the bisection.

The test for badness is something that would be run at each point in the process.

I admit that git status is not a good test, since it is possible that
git update-ref --no-deref <target>
 && git checkout <target> will not restore a clean working tree and
index at each step,
even for good commits.

Of course, this is all rather academic since I agree your suggestion of a --no-checkout option is a more general purpose solution which can do all that --ignore-checkout-failure does and more.

Show 14 quoted lines
>
> As I wrote in my footnote, if your test is to find the most recent commit,
> starting from which all the objects reachable from it are not corrupt (by
> using "rev-list --objects $commit | pack-objects"), you could run your
> bisect by somehow first finding a good commit (B5) that passes the test,
> and after knowing a bad commit (B8) that does not pass (because it is
> missing the single blob that is unreadable for B6 and B8), and then bisect
> using a slightly less expensive test
>
>        rev-list --objects B5..$commit | pack-objects
>
> to find it in theory, but "Being unable to check-out" is not an isolated
> event and cannot be used as the check as you seem to think.
>

I agree - a test that actually traverses the graph reachable from the commits each tree and visits each object is better.

I'd tweak your snippet with --max-count=1, so that amount of work per commit is limited.

Note that running git bisect --no-checkout will still be useful here since it will limit the number of iterations that need to be tested in order to find B5, for example.

Show 13 quoted lines
>
> Pros of using HEAD (i.e. the only change under the new mode would be that
> we do not touch the index nor the working tree) is that the test you would
> need to run in each step of bisection can use the familiar HEAD ref
> instead of a strange BISECT_CURSOR, "bisect reset" will take you back from
> the tentative detached HEAD state the usual way, and most likely the
> necessary change to git-bisect.sh would be smaller. Cons of using HEAD
> would be that the index and the working tree will be totally out-of-sync
> with respect to HEAD during the bisection (by definition---as that is the
> point of this new mode). One could argue that a naïve user might get
> confused, but I am not sure how big a practical downside it would be.
>
>
How about a compromise such as:
    --no-checkout[=<ref>]
which defaults to HEAD, but can be specified as something else?
jon.
Previous: Junio C HamanoNext: Johannes Sixt
Message 16 of 21 in “[RFC 0/9] bisect: allow git bisect to be used with repos containing damaged trees.”
  1. Jon SeymourJul 24, 2011
  2. 1/9 bisect: add tests to document expected behaviour in presence of broken trees.Jon Seymour, Jul 24, 2011
  3. 2/9 bisect: introduce a --ignore-checkout-failure option to bisect--helper.Jon Seymour, Jul 24, 2011
  4. 3/9 bisect: implement support for --ignore-checkout-failure optionJon Seymour, Jul 24, 2011
  5. 4/9 bisect: introduce a helper function to tolerate checkout failures.Jon Seymour, Jul 24, 2011
  6. 5/9 bisect: replace existing calls to git checkout with bisect_checkout_with_ignoreJon Seymour, Jul 24, 2011
  7. 6/9 bisect: enable --ignore-checkout-failure in the porcelain.Jon Seymour, Jul 24, 2011
  8. 7/9 bisect: better diagnostics, in case of mis-typed option.Jon Seymour, Jul 24, 2011
  9. 8/9 bisect: add tests for --ignore-checkout-failure option.Jon Seymour, Jul 24, 2011
  10. 9/9 bisect: add documentation for --ignore-checkout-failure option.Jon Seymour, Jul 24, 2011
  11. Johannes SixtJul 24, 2011
  12. Jon SeymourJul 24, 2011
  13. Junio C HamanoJul 24, 2011
  14. Jon SeymourJul 25, 2011
  15. Junio C HamanoJul 25, 2011
  16. Jon SeymourJul 25, 2011
  17. Johannes SixtJul 25, 2011
  18. Jon SeymourJul 25, 2011
  19. Jakub NarebskiJul 26, 2011
  20. Jon SeymourJul 26, 2011
  21. Jon SeymourJul 26, 2011

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.