refactor
fix condition (there might be commits with NO parent)