Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Aniket Gupta <aniketgupta3001@gmail.com>
Cc: "Hannes Brandstätter-Müller" <hannes.mueller@gmail.com>,
	git@vger.kernel.org
Subject: Re: [BUG] git apply: pure rename followed by edit fails with core.fileMode=false
Date: Fri, 06 Nov 2026 12:36:07 -0800	[thread overview]
Message-ID: <xmqqwlqpg0js.fsf@gitster.g> (raw)
In-Reply-To: <20261106181145.1070831-1-aniketgupta3001@gmail.com> (Aniket Gupta's message of "Fri, 6 Nov 2026 18:11:45 +0000")

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?

  reply	other threads:[~2026-11-06 20:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 13:53 [BUG] git apply: pure rename followed by edit fails with core.fileMode=false Hannes Brandstätter-Müller
2026-11-06 18:11 ` Aniket Gupta
2026-11-06 20:36   ` Junio C Hamano [this message]
2026-11-07  4:07     ` Aniket Gupta
2026-11-07  5:25       ` Junio C Hamano
2026-11-07  5:47         ` Aniket Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqwlqpg0js.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=aniketgupta3001@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hannes.mueller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox