Factor out common git log parsing logic