microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.93k stars 28.77k forks source link

gutter shows changes on symlink file even if git/scm says no changes #189628

Open sidvishnoi opened 1 year ago

sidvishnoi commented 1 year ago

Type: Bug

~ $ git --version
git version 2.34.1

~ $ mkdir test
~/test $ cd test
~/test $ git init
Initialized empty Git repository in ~/test/.git/
~/test $ touch file
~/test $ mkdir folder && cd folder
~/test/folder $ ln -s ../file link
~/test/folder $ cd ..
~/test $ git add .
~/test $ git commit -m "commit"
[main (root-commit) cdd16d7] commit
 2 files changed, 2 insertions(+)
 create mode 100644 file
 create mode 120000 folder/link
~/test $ git status
On branch main
nothing to commit, working tree clean
~/test $ code .

The gutter for folder/link shows changes, as if entire linked file is modified. The "Source Control" view and git status shows no changes.

image

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

Related (closed) issues: https://github.com/microsoft/vscode/issues/5970#issuecomment-1625876902, https://github.com/microsoft/vscode/issues/135778, https://github.com/microsoft/vscode/issues/121304


VS Code version: Code 1.81.0 (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:36:11.334Z) OS version: Linux x64 5.19.0-50-generic (Ubuntu 22) Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 3900X 12-Core Processor (24 x 2779)| |GPU Status|2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off| |Load (avg)|2, 1, 1| |Memory (System)|15.54GB (9.04GB free)| |Process Argv|--unity-launch --crash-reporter-id 6d263987-c422-4fe5-865f-96bd74c8d7e0| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|wayland|
Extensions (24) Extension|Author (truncated)|Version ---|---|--- project-manager|ale|12.7.0 lit-html|bie|1.11.1 firecode|ChF|1.3.0 path-intellisense|chr|2.8.4 codeium|Cod|1.2.59 vscode-eslint|dba|2.4.2 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.1.0 vscode-pull-request-github|Git|0.70.0 vscode-clangd|llv|0.1.24 rainbow-csv|mec|3.7.0 dotenv|mik|1.0.1 isort|ms-|2023.10.1 python|ms-|2023.14.0 remote-ssh|ms-|0.102.0 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.1 sublime-keybindings|ms-|4.0.10 vsliveshare|ms-|1.0.5877 material-icon-theme|PKi|4.29.0 vscode-yaml|red|1.14.0 rewrap|stk|1.16.3 code-spell-checker|str|2.20.5 svelte-vscode|sve|107.9.0 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 vscccc:30803845 282f8724:30602487 89544117:30613380 showlangstatbar:30737416 vsctsb:30748421 a2ce3375:30757347 pythonfmttext:30731395 pythoncmv:30756943 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 gsofb:30804716 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 e537b577:30795824 dsvsc013:30795093 dsvsc014:30804076 ```
lszomoru commented 11 months ago

I seems that for the symbolic link, the git command that we use to show the contents of the file returns the path to the real file instead of the content. I will have to see how to handle this:

Image

hsfzxjy commented 11 months ago

@lszomoru What about disabling gutter decoration for symblink files?

I was attempting to solve this. At first I try to reflect all operations against symblinks to their targets but there are too many corner cases to care about:

Disabling should be the simplest solution.

sidvishnoi commented 11 months ago

I work in a project with lots of symlinks - as in, primarily on symlinks instead of on files directly (shared files symlinked in a multi tenant repository). Would prefer if this is supported somehow.