Fix ahead-behind results

The logic is currently reversed. Fix that.

I went and checked manually with git each pair in the tests that I changed. This fixes #2501.

This is one for backporting too @vmg.