🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
5 messages
5 total messages Started by Aniket Gupta Fri, 06 Nov 2026 18:11
Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
#2529
Author: Aniket Gupta
Date: Fri, 06 Nov 2026 18:11
14 lines
11019 bytes
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
Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
#2542
Author: Junio C Hamano
Date: Fri, 06 Nov 2026 20:36
17 lines
13382 bytes
Aniket Gupta <aniketgupta3001@gmail.com> 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?
Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
#2571
Author: Aniket Gupta
Date: Sat, 07 Nov 2026 04:07
14 lines
11147 bytes
Hi Junio,

The series in Hannes's report is valid input which is what format-patch
makes for a commit that renames a file followed by one which edits it.
My symlink example was hand made and not valid. I only wanted to
demonstrate that the type check no longer fires. This is a minor point.

I also tried undoing the series with -R (the edit first, then the
rename) for a plain and an exe file. It works the same with and without
the change.

Thanks,
Aniket
Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
#2575
Author: Junio C Hamano
Date: Sat, 07 Nov 2026 05:25
12 lines
13017 bytes
Aniket Gupta <aniketgupta3001@gmail.com> writes:

> The series in Hannes's report is valid input which is what format-patch
> makes for a commit that renames a file followed by one which edits it.

Do you mean these are two commits, and format-patch created two
messages?

If so, applying these two patches in one invocation of "git apply"
is exactly what I was questioning.  I would understand two separate
invocations of "git apply", or "git am" fed two input files, though.
Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
#2576
Author: Aniket Gupta
Date: Sat, 07 Nov 2026 05:47
10 lines
11111 bytes
Hey Junio. Yup. Two commits. Hannes feeds the whole format-patch output
to a single git apply and separate invocations and git am work for him.
Though applying several patches that touch the same path in one
invocation is something git apply does on purpose. A pure rename
followed by an edit worked that way before 0482c32c33 and still does
with core.fileMode=true. It only breaks with =false.

Thanks,
Aniket
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads