Hannes Brandstätter-Müller reported that with core.fileMode=false, applying format-patch output containing a pure rename followed by an edit to the renamed file fails with "error: renamed: wrong type". He gave a reproduction and called it a possible regression.

Aniket Gupta reproduced it. He said the series worked before 0482c32c33 and still works with core.fileMode=true, and that the failure comes from taking the whole mode from patch->old_mode, which also takes the file type. As a result the "wrong type" check can no longer fail. In a hand-made case where a pure rename of a regular file is followed by a patch claiming a symlink, core.fileMode=true rejects it but =false applies it and turns the file into a symlink.

Gupta proposed S_IFREG | (patch->old_mode & 07777), which passed Hannes's test and the other apply tests. He also said undoing the series with -R behaves the same with and without the change.

Junio C Hamano questioned the premise, asking why the input patch talks about the same path twice and whether this is valid input or bending the tool to cope with corrupt input. He said he would understand two separate invocations, or git am fed two files.

Gupta answered that this is what format-patch produces for a rename commit followed by an edit commit, and that applying several patches touching the same path in one invocation is something git apply does on purpose. He added that his symlink example was hand made and not valid. The thread has no decision yet.