Have you ever used git bisect? If so, how did you use it? Did it help you find a problem which would otherwise be difficult to find? Story time, I guess?

  • 𝕊𝕚𝕤𝕪𝕡𝕙𝕖𝕒𝕟
    link
    fedilink
    English
    arrow-up
    12
    ·
    1 year ago

    I don’t use it often, but when I do it saves me hours.

    For example, I used it recently in a large project that had no CI. The build failed, and I could find the first commit it failed on using bisect in a couple of minutes.

  • Jim
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 year ago

    Story time:

    There was a long data pipeline that produced wrong results. The wrong results were subtle but reproducible. Each run was about an hour long in dev, and there was no intermediate data set. It takes some input, runs for an hour, and produces an output.

    The code was inherited and was a bit of a mess. Instead of digging through the code, I re-ran the pipeline through from about 6 months ago when we knew there was know bug. It was about 100+ commits since that time.

    Mind you, the bug could’ve been anywhere in the codebase as far as I was concerned.

    Took about a day of git bisect to narrow it down… to nothing. I found out that running code from the first commit from 6 months ago also produced incorrect data. Oops. That’s weird though because the code was running correctly back then.

    A few days of debugging later, and I eventually found the culprit: a dependency package got bumped a couple weeks back. Some sort of esoteric parser had a bug but didn’t fail. It incorrectly parsed some data after the bump. Going back a version fixed the bug.

    So yeah, git bisect killed about a day of my time.

    • canpolatOPM
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 year ago

      Now that you know the problem, do you think there would have been a way where git bisect would have found the problem? I don’t know how your dependencies are handled, but if they are part of the code base (like NuGet packages referenced from project files) then I would expect bisect to find the offending commit where the dependency is bumped?

  • embix@feddit.de
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    1 year ago

    Seems like most of the answers are on another instance and my client does not show them here. For those having the same problem: check here.

    Federation is fun and all, but having “the same” sub on multiple instances does not make it easier atm.