another failed attempt at fixing tests, help needed

The tests don't show us that the real code is failing. *The tests themselves are failing.*

This pull request is based on a branch I pushed to magit/magit. This allows anyone with commit access to bang on it some more and easily rerun the travis tests without having to create a new (fake) pull request, just to test whether the tests still blow up or not.

**Help is highly welcome.**

The original state of this branch can be seen at https://github.com/tarsius/magit/tree/fix-tests