From: Lidong Yan Date: Sun, 29 Jun 2025 03:10:57 GMT Subject: Re: [PATCH 0/5] fix apply --intent-to-add Message-ID: <16943C7D-C331-482E-BFDD-236E8E79552A@gmail.com> In-Reply-To: <20250628225819.1294068-2-ray@ameretat.dev> Raymond E. Pasco writes: > The --intent-to-add (-N) flag to apply has not worked properly since its > introduction in Git 2.19; in particular, it creates an empty index > except for any new files in the patch, making it largely useless except > on blank repositories. I find the problem is that when we use 'git apply —intent-to-add’, git doesn’t read index file then update the intent-to-add cache entry, git forgot to read the index file and only update one intent-to-add cache entry in index file. > This patch series fixes it to work as expected and updates the tests > and documentation for this flag. I think [PATCH 2/5] actually solve the problem. [PATCH 3/5] makes 'git apply' consistent with 'git add', which means git add —intent-to-add exist-in-index-file.c and git apply —intent-to-add patch-contains-exist-in-index-file will ignore intent-to-add and do nothing.