Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For the given command, if the assumption is the command failed recently, it's likely faster than bisect. You can start it and go grab a coffee. It's automatic.

I wish my usage of bisect were that trivial, though. Usually I need to find a bug in a giant web app. Which means finding a good commit, doing the npm install/start dance, etc. for each round.



I've had to git bisect a react native app in a monorepo before. Took me nearly a day to track down the commit, due to the size of node_modules and the need to do a `pod install` every time.


> and the need to do a `pod install` every time.

Phrasing makes it sound like you were doing it manually, so if you didn't know, you can just drop a script in the directory, say, "check.sh":

  #!/bin/bash
  if ! pod install; then
      exit 125
  fi
  do-the-actual-test
make it executable, and:

  git bisect run ./check.sh
The special exit code 125 tells bisect "this revision can't be tested, skip it", otherwise it just uses exit code 0 for "good" and 1-127 (except for 125) for "bad".


Thanks so much for posting this :D

It did require manual user interaction, so I had to interact with the app for quite a while in between bisect checkouts, the waiting for the installs was more the worse part over the actual tedium of running commands.


Since we're in a "bash patterns" thread anyway... the script it's running can do whatever, so let's extend it so it works in your case too, by asking you if it's good or not, so you can still do manual app interaction with "bisect run":

   #!/bin/bash

   if ! pod install; then
       exit 125
   fi

   Q=
   while [[ "$Q" != 'y' && "$Q" != 'n' ]]; do
       read -p 'Is this revision good? [y/n] ' Q
   done

   [[ "$Q" == 'y' ]]


As long as you can detect your bug from a script, you can pass the script to git bisect run and it'll run automatically.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: