sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Renaming detecting

Open diverger opened this issue 3 years ago • 12 comments

When I rename one file. SM will record it as a file deletion and a new file addition. May SM detect the 'renaming' and record it as a name change? Then the file's changing history is retained.

diverger avatar Mar 26 '22 07:03 diverger

What happens when you stage the deletion and addition?

willrowe avatar Mar 28 '22 13:03 willrowe

The reason I asked that is that, unless you are experiencing a bug, it should detect the rename when you stage the deletion and addition.

willrowe avatar Mar 29 '22 19:03 willrowe

No, they are showed as two files when I commit them at least. I will check it in the history, may there they are treated as renaming? I'm a newer to SM.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Will Rowe @.> Sent: Wednesday, March 30, 2022 3:56:54 AM To: sublimehq/sublime_merge @.> Cc: diverger @.>; Author @.> Subject: Re: [sublimehq/sublime_merge] Renaming detecting (Issue #1448)

The reason I asked that is that, unless you are experiencing a bug, it should detect the rename when you stage the deletion and addition.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsublimehq%2Fsublime_merge%2Fissues%2F1448%23issuecomment-1082315665&data=04%7C01%7C%7C654e8313765b469d445208da11be4696%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637841806192480040%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1%2BlzSPiJZCBzIOJnejqodqMGw1M8o6e8OLyjkTi7Wog%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACR5TWUOKAVC7EBZ63VYULVCNOANANCNFSM5RWF76HA&data=04%7C01%7C%7C654e8313765b469d445208da11be4696%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637841806192480040%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ee72MilvZShdlFo7SUH%2Bb7uFRRY3RXi%2BX5X%2BdZqO%2FL4%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

diverger avatar Mar 30 '22 00:03 diverger

I've checked the history, the renamed file are treat as a complete new one. The new file doesn't inherit the old file's history.

diverger avatar Mar 31 '22 11:03 diverger

I am not sure about this, but that may happen if you rename the file and change the contents of it in the same commit. Regardless though, I do not believe that is SM specific, it just follows how Git functions. If there is a discrepancy between how SM handles this and how Git handles it on the CLI, then there would be a bug.

willrowe avatar Mar 31 '22 12:03 willrowe

Yes, usually renaming is companioned with content changing, so this may be the reason.

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: Will Rowe @.> Sent: Thursday, March 31, 2022 8:26:09 PM To: sublimehq/sublime_merge @.> Cc: diverger @.>; Author @.> Subject: Re: [sublimehq/sublime_merge] Renaming detecting (Issue #1448)

I am not sure about this, but that may happen if you rename the file and change the contents of it in the same commit. Regardless though, I do not believe that is SM specific, it just follows how Git functions. If there is a discrepancy between how SM handles this and how Git handles it on the CLI, then there would be a bug.

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsublimehq%2Fsublime_merge%2Fissues%2F1448%23issuecomment-1084513828&data=04%7C01%7C%7C4530088cfd4446cdff4b08da1311a34b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637843263739148107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=kiGG9o54UOIh5Q367ZuinbFpbKT7hgWzVWPJKcO4rNo%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACR5TTERHZWSJUWWGHGPDTVCWKWDANCNFSM5RWF76HA&data=04%7C01%7C%7C4530088cfd4446cdff4b08da1311a34b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637843263739148107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=g1%2Fm3hb5kF%2B8FBS0ELtiFXh09a5EImoiEb1Gq%2BdCC2g%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

diverger avatar Apr 06 '22 02:04 diverger

possible duplicate: #384

srbs avatar Jul 08 '22 03:07 srbs

I ran into this issue just now. In the CLI Git identifies a rename, but Sublime Merge shows it as an addition and a deletion.

CLI: Screenshot_20220825_205904

Sublime Merge: Screenshot_20220825_205916

andrej-petrovic avatar Aug 25 '22 20:08 andrej-petrovic

Hi @andrejp88,

Thanks for reaching out!

The rename detection uses a similarity content-based heuristic to determine if a rename has occurred, and doesn't always match what the command line behavior. Could you confirm if there are significant content changes to the renamed file?

Kind regards, - Dylan

dpjohnst avatar Oct 19 '22 01:10 dpjohnst

Hi @dpjohnst, indeed there were quite a few changes to the file. git diff reports a similarity index of 54%. At a glance, I would say most lines were unchanged, and those that did change only modified or removed one or two short segments of text. I've attached an excerpt from the diff shown by the Git CLI. To the human eye, it's obvious that it's the same file, but I suppose if the algorithm only looks at lines modified, then it looks quite different.

Screenshot_20221019_122232

andrej-petrovic avatar Oct 19 '22 11:10 andrej-petrovic

I've got the same issue . As for me this given function is not quite reliable. Here's an example. GitHub figures this commit as it is as renaming with minor changes, while SublimeMerge commit shows:

  • Cargo.toml is renamed.
  • main.rs as new one.

yaroslavyaroslav avatar Nov 19 '22 08:11 yaroslavyaroslav