dillonkearns/legit — pull request #1 by michaelqlarson (2013-02-18 05:40:42+00:00)
Title: Legit bisect

Hi Dillon,

I expanded *Legit* to simplify the git bisect process. This isn't a full automation, but it is a huge step forward in reducing the amount of developer time involved in running a bisect. Here's how *Legit Bisect* works:

Old workflow:
```
1. check out the branch of the known failure
2. run the test to verify it is failing at HEAD
3. dig through your CI reports and find a SHA that predates that failure that returned a clean build
4. git bisect start
5. git bisect good
6. git bisect bad
7. run your test
8. Depending on test results:
* git bisect good
* git bisect bad
* git bisect skip (if test doesn't yet exist for current commit)
9. run your test again
10. rinse repeat
11. when finished:
* git bisect reset
```

*Legit Bisect* initiates a git bisect that assumes HEAD is bad, and HEAD 16 commits ago was good. 16 minimizes the number of expected steps while giving you plenty of scope. A specific SHA or a number of steps can be passed as an argument.

*Legit Bisect* also accepts a string, which could be a test case. For instance:

```
legit bisect "ruby test/unit/user_test.rb"
```

This will automatically run your user_test.rb test case once for each step of the bisect.

```
legit bisect "ruby test/unit/user_test.rb -n'/user/'"
```

If you're using Shoulda, you can run specific tests with a regex search flag.

```
legit bisect "rake test:javascripts"
```

You can also pass rake tasks, bash scripts, ruby one-liners - anything that can be put into a string, automatically for each iteration.

In addition to reducing the time it takes to perform a bisect, *Legit Bisect* reduces the number of key strokes. At each step, just type g, b, s or q for "git bisect good", "git bisect bad", "git bisect skip", "git bisect reset" respectively.

Workflow with *Legit Bisect*
1. check out the branch of the known failure
2. legit bisect ""
3. check back in a minute to see whether test case passed
4. press g, b, s accordingly
5. rinse, repeat
6. when it finishes, hit q to exit