Avoid an infinite loop when a cherry pick would lead to an empty commit at the boundary of the cherry-picked range.