Repository: vscode
Issue: Git - diff view does not work for PDF files
Labels: bug,git


Type: <b>Bug</b>

Steps to reproduce:

1. Create a Git repository and put a PDF file into it.
2. Commit the PDF file.
3. Change the PDF file.
4. Repeat 2. and 3.
5. In the _Source Control_ view, click the PDF filename.
6. Click _Open Anyway_ and select the default text editor.
7. Two columns open that should show the old and the new version of the PDF. However, only the new version on the right is displayed correctly. On the left, only one character (``, reads like `FF`) is displayed. (The two PDF file versions are almost identical in my example.)

![Image](https://github.com/user-attachments/assets/409676dd-1649-4ccb-941d-56bac5d935d3)
![Image](https://github.com/user-attachments/assets/ab285c16-0bb4-4f64-954f-dc7b72d4ba70)

8. Now, in the _Source Control Graph_, click the second commit from 4.
9. This time, Both sides of the diff only show the character from before.

![Image](https://github.com/user-attachments/assets/50c510e4-2599-45fd-b4f1-6062a7763277)

It seems like the wrong content is shown for PDFs that are not currently checked out.

----

Note: In practice, one would usually not look at PDFs like this, of course. One would use a PDF viewer extension. However, this bug causes the PDF viewers to also fail to show the old versions as described e.g. in https://github.com/tomoki1207/vscode-pdfviewer/issues/70, since they do not receive the correct PDF. The steps above show that the issue does not lie with the extensions.

----

VS Code version: Code - Insiders 1.95.0-insider (fe997185b5e6db94693ed6ef5456cfa4e8211edf, 2024-10-23T05:06:13.568Z)
OS version: Windows_NT x64 10.0.22631
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz (6 x 3000)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<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>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|15.78GB (4.50GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details>Extensions: none<details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256198
vsc_aacf:30263846
vscod805cf:30301675
vsaa593:30376534
py29gd2263:31024238
c4g48928:30535728
a9j8j154:30646983
962ge761:30841072
pythongtdpath:30726887
pythonnoceb:30776497
asynctok:30898717
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
da93g388:31013173
dvdeprecation:31040973
dwnewjupyter:31046869
nb_pri_only:31057983
nativerepl1:31134653
refactort:31084545
pythonrstrctxt:31093868
wkspc-onlycs-t:31132770
nativeloc1:31118317
wkspc-ranged-t:31151552
cf971741:31144450
e80f6927:31120813
autoexpandse:31146404
12bdf347:31141542
iacca1:31150324
notype1:31143044
dwcopilot:31158714
g7688163:31155431

```

</details>

<!-- generated by issue reporter -->