From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: "sebastien.stettler" <sebastien.stettler@proton.me>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git rename/moved status unreliable in ruby
Date: Mon, 04 May 2026 06:59:47 +0900 [thread overview]
Message-ID: <xmqqo6iwrw6k.fsf@gitster.g> (raw)
In-Reply-To: <026b84f4-7052-4d5b-a9ae-c2487569d1ee@gmail.com> (Phillip Wood's message of "Fri, 1 May 2026 16:30:16 +0100")
Phillip Wood <phillip.wood123@gmail.com> writes:
> Hi Sebastien
>
> On 01/05/2026 06:05, sebastien.stettler wrote:
>> 1. What did you do before the bug happened? (Steps to reproduce your issue)
>>
>> when moving ruby classes between namespaces they are marked as new files and the old
>> ones are marked as deleted
>>
>> if i only change the class name it will mark it as renamed
>
> Rename detection is based on how similar the two files are. Looking at
> the example you linked to below you're changing a file that looks like
> ...
> Which means that git sees that every line has changed because the
> indentation has changed. If you want git to realize that the file has
> been renamed you could move it in one commit and then add modify it in
> the next commit.
I've seen this repeated many times, but it is misleading to give it
without qualifying when that "works" and when it does not. Such a
"stick to pure rename and make huge changes elsewhere" strategy
would help your "git log -M [--follow]" and possibly "git rebase",
but it would not help all that much if you are doing "git diff" or
"git merge".
next prev parent reply other threads:[~2026-05-03 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 5:05 git rename/moved status unreliable in ruby sebastien.stettler
2026-05-01 15:30 ` Phillip Wood
2026-05-02 7:25 ` Johannes Sixt
2026-05-03 21:59 ` Junio C Hamano [this message]
2026-05-02 8:06 ` Chris Torek
2026-05-02 9:34 ` sebastien.stettler
2026-05-04 10:00 ` Jeff King
2026-05-05 0:09 ` Junio C Hamano
2026-05-05 0:46 ` Chris Torek
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=xmqqo6iwrw6k.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=phillip.wood123@gmail.com \
--cc=sebastien.stettler@proton.me \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.