update-index: refactor mark_valid() in preparation for new options