fix bug with half-present repos introduced by the split of gitdir from working tree in v2.17.0.