sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
273 stars 14 forks source link

Renaming detecting #1448

Open diverger opened 2 years ago

diverger commented 2 years ago

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.

willrowe commented 2 years ago

What happens when you stage the deletion and addition?

diverger commented 2 years ago

Sorry, this should be a feature demanding.

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


From: Will Rowe @.> Sent: Monday, March 28, 2022 9:36:27 PM To: sublimehq/sublime_merge @.> Cc: diverger @.>; Author @.> Subject: Re: [sublimehq/sublime_merge] Renaming detecting (Issue #1448)

What happens 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-1080660794&data=04%7C01%7C%7C60f593a7d13244a1deb008da10bff6aa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637840713930245785%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=IrddGbZFDoN8Z8JmPtYHckc32J5epyvw%2FDI93jleS%2FI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACR5TTEIZ4AOTJ4V7O2SNLVCGYVXANCNFSM5RWF76HA&data=04%7C01%7C%7C60f593a7d13244a1deb008da10bff6aa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637840713930245785%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=sgvnvfUm9vhv73DDFP3Axl3XvElmLZCpBuMPpjPraZ8%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

willrowe commented 2 years ago

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.

diverger commented 2 years ago

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 commented 2 years ago

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.

willrowe commented 2 years ago

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.

diverger commented 2 years ago

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: @.***>

srbs commented 2 years ago

possible duplicate: #384

andrejp88 commented 2 years ago

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

dpjohnst commented 1 year ago

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

andrejp88 commented 1 year ago

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

yaroslavyaroslav commented 1 year ago

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: