Fix GH-1867: non-deterministic name for git editables on Python 3

Determine `names_by_commit` deterministically.

This fixes GH-1867.