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