builtin/apply: move 'apply_in_reverse' global into 'struct apply_state'