Subject: Re: [PATCH 3/5] apply: only write intents to add for new files

From: Junio C Hamano <[email-masked]>
Date: Mon, 30 Jun 2025 11:53:16 -0700

"Raymond E. Pasco" <[email-masked]> writes:

> In the "update only the worktree" mode, the index should not be touched
> except to record intents to add when --intent-to-add is on. Because
> having --intent-to-add on sets update_index, to indicate that we are
> touching the index, we can't rely only on that flag to decide whether to
> write an index entry.

Does that let us inspect state->ita_only alone and conclude that
state->update_index is set, though?  IOW ...

>  	if (patch->conflicted_threeway)
>  		return add_conflicted_stages_file(state, patch);
> -	else if (state->update_index)
> +	else if (state->check_index || (state->ita_only && patch->is_new > 0))

... I would have expected the new code to check not just ita_only but
check ita_only only when update_index is in effect.

>  		return add_index_file(state, path, mode, buf, size);
>  	return 0;
>  }