Re: [PATCH v3] Teach git apply to respect core.fileMode settings
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 26, 2023, 19:18 UTC
- Message-ID
- <fb022e3c-adb5-e341-9fd0-9c5311abe908@gmx.de>
- In-Reply-To
- <xmqq4jg4j28z.fsf@gitster.g>
Hi Junio,
On Tue, 26 Dec 2023, Junio C Hamano wrote:
Show 5 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> 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.
Show 11 quoted lines
> 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