git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false

From
AGAniket 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

Previous: Hannes Brandstätter-MüllerNext: Junio C Hamano
Message 2 of 8 in “[BUG] git apply: pure rename followed by edit fails with core.fileMode=false”
  1. Hannes Brandstätter-MüllerOct 23, 2026
  2. Aniket GuptaNov 6, 2026
  3. Junio C HamanoNov 6, 2026
  4. Aniket GuptaNov 7, 2026
  5. Junio C HamanoNov 7, 2026
  6. Aniket GuptaNov 7, 2026
  7. Patrick SteinhardtNov 9, 2026
  8. Aniket GuptaNov 9, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.