Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git - Source control is not able to detect renaming a file #236857

Open
github-account1111 opened this issue Dec 23, 2024 · 0 comments
Open

Git - Source control is not able to detect renaming a file #236857

github-account1111 opened this issue Dec 23, 2024 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues timeline-git Timeline view issues with Git history
Milestone

Comments

@github-account1111
Copy link

github-account1111 commented Dec 23, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.96.2
  • OS Version: Windows 11

This has already been requested in #128981 but was chalked up to git's limitations despite git clearly being able to detect the file changes and, as a result, reconcile the file history (i.e. Timeview) even after a rename.

Steps to Reproduce:

  1. Rename or move a file with git mv without modifying any file contents.
  2. Commit
  3. Click on any commit in the Timeview

Expected behavior:

No change to timeview or individual commit contents.

Actual behavior:

The timeline and commit names are shown, but the contents are empty:

Image

Image

Edit: to be clear, renames can be both detected and dealt with using the following commands:

  • List all the renames in the repo:
> git log --summary --diff-filter=dam # all the renames in the repo
...
rename OldFileName1.ps1 => NewFileName1.ps1 (97%)
rename OldFileName2.ps1 => NewFileName2.ps1 (100%)
...
  • List all the renames for a particular file:
> git log --summary --diff-filter=dam --follow -- .\NewFileName1.ps1 # for a particular file
...
rename OldFileName1.ps1 => NewFileName1.ps1 (97%)
...
  • Show file contents for a particular file before a rename:
git show 42fcd1b:OldFileName1.ps1

... where 42fcd1b is the commit hash.

There are probably other, possibly better, ways, but this is the most straightforward way I've found and been using.

@lszomoru lszomoru added git GIT issues timeline-git Timeline view issues with Git history bug Issue identified by VS Code Team member as probable bug labels Dec 24, 2024
@lszomoru lszomoru changed the title Source control is not able to detect renaming a file Git - Source control is not able to detect renaming a file Dec 24, 2024
@lszomoru lszomoru added this to the Backlog milestone Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues timeline-git Timeline view issues with Git history
Projects
None yet
Development

No branches or pull requests

2 participants