Repository: vscode
Issue: Git - Problematic diff with nested repos
Labels: bug,git,confirmed

Type: <b>Bug</b>

**Step 1.** Create nested repos with structure:
```bash
.
├── .git
└── subdir
    ├── .git
    ├── .gitignore
    ├── script.py
    └── test.ipynb
```

Outer repo tracks files:
```bash
subdir/.gitignore
subdir/script.py
subdir/test.ipynb
```

Inner repo tracks files:
```bash
.gitignore
script.py
```

Content of `subdir/.gitignore`:
```
*.ipynb
```

Content of `subdir/script.py`:
```python
if __name__ == "__main__":
    print("Hello world!")
```

The notebook `subdir/test.ipynb` has two cells:
```python
import numpy as np
import matplotlib.pyplot as plt
```
and
```
xx = np.linspace(-1, 1, 10001)
yy = np.sin(1.0 / (np.abs(xx) + 1e-3) * np.sign(xx))

plt.plot(xx, yy);
```

All above file states are committed to the repos that track them.

**Step 2.** Make a change in the notebook, e.g. change line:
```python
xx = np.linspace(-1, 1, 10001)
```
to
```python
xx = np.linspace(-0.1, 0.1, 10001)
```

**Step 3.** Open the source control tab and open the changes of `subdir/test.ipynb`. The vscode diff tool shows as if the left notebook was empty:

![image](https://github.com/microsoft/vscode/assets/13967024/e3803854-74ac-46db-9ef5-6bce532f9ba8)


If I remove `subdir/.git`, the diff is correct:
![image](https://github.com/microsoft/vscode/assets/13967024/8d7097fd-ed4e-4ea6-bfee-2b5326500fcb)


VS Code version: Code 1.80.1 (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:22:25.257Z)
OS version: Linux x64 6.1.0-10-amd64
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 3565)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|0, 1, 1|
|Memory (System)|15.33GB (7.06GB free)|
|Process Argv|-n . --crash-reporter-id 8f798291-6415-427e-b313-66a64b14d07c|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|gnome|
|XDG_CURRENT_DESKTOP|GNOME|
|XDG_SESSION_DESKTOP|gnome|
|XDG_SESSION_TYPE|wayland|
</details><details><summary>Extensions (7)</summary>

Extension|Author (truncated)|Version
---|---|---
python|ms-|2023.12.0
vscode-pylance|ms-|2023.7.40
jupyter|ms-|2023.6.1101941928
jupyter-keymap|ms-|1.1.2
jupyter-renderers|ms-|1.0.17
vscode-jupyter-cell-tags|ms-|0.1.8
vscode-jupyter-slideshow|ms-|0.1.5


</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263cf:30792227
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
89544117:30613380
showlangstatbar:30737416
vsctsb:30748421
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30785052
pythongtdpath:30769146
i26e3531:30792625
gsofb:30797622
pythonnosmt12:30797651
pythonnoceb:30797650
e537b577:30795824
dsvsc013:30795093
dsvsc014:30797589

```

</details>

<!-- generated by issue reporter -->