Hi Junio, On Tue, 26 Dec 2023, Junio C Hamano wrote: > Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > > > While at it, add some defensive code to ignore `ce_mode` should it be 0. > > Is it defensive or is it hiding a problematic index under the rug? I wrote this defensive code only out of habit, not because I saw a `ce_mode` that was 0. > If there is an index entry whose ce_mode is 0, I suspect we would > want to error out with a BUG(), unless it is an intent-to-add entry. > > Shouldn't it cause an error to apply a patch that mucks with > "newfile" after you did > > $ git add -N newfile > > If we allow ce_mode==0 to be propagated to st_mode, I suspect we > will catch such a case with the "mode is different" warning code, at > least. Is `ce_mode == 0` an indicator of a new file? In my tests, `git add -N` will add the file with a non-zero mode... Ciao, Johannes