googlefonts / googlefonts/fontmake

fontmake bisection to locate first commit that produces a compiler error

Open
#756 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
888
Forks
97
Avg merge
4d 52m
Merged PRs (30d)
1

Description

I made [a demo project](https://github.com/chrissimpkins/fontmake-bisection-tests) to explore the use of an automated git + fontmake approach to bisect a git history for a commit that leads to a compiler error (i.e., anything that results in a non-zero exit status code). The project inserts a commit with an incompatible outline and ten subsequent commits with the error in place. With `git bisect run` and a simple, one-line shell script, you can locate the first bad commit automatically.

The steps are:

Prep a shell script that includes your fontmake command:

##### run.sh

```sh
fontmake -m src/FBT.designspace -o variable
```

make it executable (and don't commit it):

```
$ chmod +x run.sh
```

set your known good and bad commit range with `git bisect start`:

```
$ git bisect start [KNOWN BAD COMMIT] [KNOWN GOOD COMMIT]
```

This places you in a detached HEAD state, ready to start the bisection routine.

Execute the shell script via `git bisect run`:

```
$ git bisect run ./run.sh
```

Grab a coffee if you are compiling a large project. git automatically executes your fontmake command and marks non-zero exit status code results as bad commits, zero exit status code results as good commits until it locates the first bad commit in the range.

Reset git at the end of your bisection run:

```
$ git bisect reset
```

You can give it a try it on the demo project with (assumes fontmake is on PATH):

```
$ git clone https://github.com/chrissimpkins/fontmake-bisection-tests.git
$ cd fontmake-bisection-tests
$ git bisect start d58eb16aa69d913643293c37a44e89ffafb10192 b5c27cc3187297affdf5beb47b611b3ae55636d2
$ echo "fontmake -m src/FBT.designspace -o variable" > run.sh
$ chmod +x run.sh
$ git bisect run ./run.sh
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.