-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 gutters don't show when you Uppercase a filename #29861
Comments
It seems this is because Windows treats file case insensitively, but git's object storage treats them case sensitively. Therefore, to git only From what I can tell VS Code executes The only solution I can think of would be in the cases that If no one can think of a better solution I'd be happy to write a PR for this. |
I know the difference between Windows and Unix based system about the filename case sensitive but git and vscode are software that run not only in Windows bus also in macOS and Linux. I think due to Windows "limitations" the only case you can't have is two files with these name: app.js and App.js but you have to handle the rename from app.js to App.js for git and the other OS. |
I'm not sure I understand what you mean. What I was trying to explain was that because windows treats As for the rename there are ways of getting git to recognize this (using |
Renaming a file creates a new file and removes the old renamed file and makes the new file unstaged. For that reason, unstaged file doesn't show the git gutters. Thus, this is not directly related to renaming a file with uppercase letters. It happens when you rename the file no matter what. Same problems happens if you create a new file, it doesn't show the git gutters. @joaomoreno I would like to take a look at this but I am not sure what can be done in terms of fixing the issue. Should unstaged files show git gutters or renaming a file should automatically staged the newly created file? |
Actually, like @bugrac, I'm not so convinced we should do anything. For git this is a simple file move, for which the disappearance of the gutter decorations makes sense. I don't think unstaged files should show gutter decorations and we should definitely not automatically stage anything. What is interesting for me is that git continues to report the file as lowercase after the rename. |
I haven't come across a use case for renaming the case of a file where the history isn't wanted to be kept. If I change the case of a filename, it's usually a correction for style rather than a desire to create a new file. Interestingly, the file extensions/git/src/git.ts doesn't include mv in its available commands. If you manually do a git mv on a file after changing the case in vscode, it behaves more how I would want it to in vscode. YMMV. |
Code doesn't need to. The equivalent of |
I ran tests to check this:
|
What happens if you rename the file in the Windows Explorer and run
This is a bad idea since it involves automatically staging changes. |
I agree. Automatic staging of files would be more annoying than helpful and
once you unstage the file it turns back into delete + add operations.
I also have never run into a case where I'd want to change the case of a
filename and not want that tracked by git, and I'd presume that this would
be a fairly rare case.
However not handling untracked filename case changes is an edge case that
VS Code does not handle.
For showing git gutters on files that have been moved but not yet staged, I
wonder if VS Code could use the same algorithm that git uses to turn an add
+ delete into a move upon staging to determine the move operation, and use
that in its diffing.
… |
OK. Off to find another issue :) |
We've had issues creating files/folders in VSCode on Mac (case-insensitive), then building the app on a Linux server. Occasionally half the files in a folder will show up in MyFolder and the rest in myfolder. |
Here is some sample code that may be relevant here. I came across it for doing fuzzy searches: const searchTerms = (opts.caseSensitive) ? new RegExp(term) : new RegExp(term, 'i') The In that example, My overall point would be that there could and probably should be some kind of |
Fixed by #49397 |
Git gutter doesn't show when you Uppercase a filename (partial or full)
Steps to Reproduce:
1.Add some code to an existing repository and rename the filename with an Uppercase (in the screenshot app.js -> App.js)
2.The git gutters disappear and the Source Control tab stage the changes with the old filename (app.js instead of App.js)
3. Commit the staged changes
4. Add some code to the renamed file
5. Git gutters doesn't show again but the Working Tree looks good
6. If you rename the files as before (App.js -> app.js) the git gutters appear correctly
The text was updated successfully, but these errors were encountered: