From: Junio C Hamano Date: Fri, 06 Nov 2026 20:36:07 GMT Subject: Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false Message-ID: In-Reply-To: <20261106181145.1070831-1-aniketgupta3001@gmail.com> Aniket Gupta writes: > 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. Why does the input patch talk about exactly the same path twice in the first place, though? Are we talking about a valid patch input, or are we bending the tool to cope better with corrupt input? > Would S_IFREG | (patch->old_mode & 07777) be better? That passed your > test and the other apply tests for me. Would it work equally well when applying the patch in reverse?