Repository: vscode
Issue: Git - Stage Selected Range Bug with Path Capitalisation
Labels: bug,git

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: **Yes**/No

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
**VS Code Version:** 
- Version: 1.91.0 (user setup)
Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
Date: 2024-07-01T18:52:22.949Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631

**OS Version:** 
Edition	Windows 11 Pro
Version	23H2
Installed on	‎22/‎09/‎2022
OS build	22631.3810
Experience	Windows Feature Experience Pack 1000.22700.1020.0

**Steps to Reproduce:**

Hey team. Think I've uncovered a bug with the stage selected / stage selected range feature in the latest VSCode Update. 
E.g. I've got a file `/client/src/LetterWriter/toolbar/WriterToolbar.tsx` where I want to stage just this change on line 88. See image below


![image](https://github.com/microsoft/vscode/assets/66514580/676107c3-9ed3-48f0-bfc2-88f432bfe060)

When I click this + here, the following happens. For some reason VSCode thinks the capitalisation of the direct parent folder (actually `toolbar` with a lowercase "t") has changed to an uppercase. As seen below it duplicates the file in the working tree and the staged changes show the uppercase "T". 

![image](https://github.com/microsoft/vscode/assets/66514580/1d916fa1-1bde-48b6-980b-ffbe465c3e5e)

Is this a git bug somehow (Edit: I don't think so given my first comment)? On Github, the path is definitely lowercase and the same on my local disk. See below:

![image](https://github.com/microsoft/vscode/assets/66514580/7c8ff948-58d0-441e-907c-80799c934571)
![image](https://github.com/microsoft/vscode/assets/66514580/43bef4e1-d321-4bc0-afae-c8577044ed18)

I've tried clearing git cache but this issue is persistent and I've encountered the same issue with other folders too :(. I haven't ever changed the capitalisation of this `toolbar` folder.

The change (line 88) does move from the working tree but only on the file with the incorrect path. Before a recent update this feature worked perfectly. Has something changed? I really like this feature and it would be good if it could be fixed.

A `git status` does also show the same as VSCode's src control tab so I'm wondering if the issue might be there instead.

```console
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   client/src/components/LetterWriter/Toolbar/WriterToolbar.tsx           <<<< (observe wrong path)
        renamed:    client/src/components/LetterWriter/getSelectedNode.tsx -> client/src/components/LetterWriter/utils/getSelectedNode.tsx

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   client/src/components/LetterWriter/LetterWriter.tsx
        modified:   client/src/components/LetterWriter/Toolbar/WriterToolbar.tsx            <<<<<
        modified:   client/src/components/LetterWriter/toolbar/WriterToolbar.tsx             <<<<< (observe duplicate file with different path)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        client/src/components/LetterWriter/plugins/AutoLinkPlugin.tsx
        client/src/components/LetterWriter/plugins/FloatingLinkEditorPlugin/
        client/src/components/LetterWriter/plugins/LinkPlugin.tsx
        client/src/components/LetterWriter/utils/canUseDOM.ts
        client/src/components/LetterWriter/utils/setFloatingElemPositionForLinkEditor.ts
        client/src/utils/url.ts
```