Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
- From
- Aniket Gupta <aniketgupta3001@gmail.com>
- Date
- Nov 6, 2026, 18:11 UTC
- Message-ID
- <20261106181145.1070831-1-aniketgupta3001@gmail.com>
- In-Reply-To
- <CANuH12niCO_tU+=dikanZ9Wf30NFsz4jpnZBXW6OyeQfD26jtg@mail.gmail.com>
Hi Hannes,
I was able to repro this. One thing I noticed: taking the whole mode from patch->old_mode also takes the file type, so the "wrong type" check can no longer fail. With a pure rename of a regular file followed by a hand-made patch that says it is a symlink, core.fileMode=true rejects it but =false applies it and turns the file into a symlink.
Would S_IFREG | (patch->old_mode & 07777) be better? That passed your test and the other apply tests for me.
Thanks, Aniket