microsoft / vscode

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

Git checkout dropdown includes non-existing remote #137425

Closed AlCalzone closed 2 years ago

AlCalzone commented 2 years ago

Issue Type: Bug

When trying to switch branches in VSCode, the dropdown includes branches from a remote that no longer exists: grafik

Attempting to check out these branches results in an error

Git: fatal: Cannot setup tracking information; starting point 'AlexCPU/vitrum-fixes' is not a branch.

Neither git remote -v nor git branch -vv include any reference to this remote. It also does not appear in ~/.gitconfig nor the local .git/config.

How can I remove these entries?

VS Code version: Code 1.62.2 (3a6960b964327f0e3882ce18fcebd07ed191b316, 2021-11-11T20:56:38.428Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 3900X 12-Core Processor (24 x 3793)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.91GB (17.38GB free)| |Process Argv|--folder-uri file:///c%3A/Repositories/node-zwave-js --crash-reporter-id 334f021d-210d-4760-a7f9-f7e771ce0905| |Screen Reader|no| |VM|0%|
Extensions (48) Extension|Author (truncated)|Version ---|---|--- codesnap|adp|1.2.1 tsl-problem-matcher|amo|0.5.0 vscode-zipfs|arc|2.3.0 vscode-eslint|dba|2.2.2 gitlens|eam|11.6.1 toggle-excluded-files|eam|1.7.0 EditorConfig|Edi|0.16.4 RunOnSave|eme|0.2.0 json-tools|eri|1.0.2 prettier-vscode|esb|9.0.0 copilot|Git|1.7.3862 vscode-pull-request-github|Git|0.32.0 vscode-test-explorer|hbe|2.21.1 rest-client|hum|0.24.5 template-string-converter|meg|0.5.4 git-graph|mhu|1.30.0 compare-folders|mos|0.22.2 vscode-json5|mrm|1.0.0 vscode-docker|ms-|1.18.0 vscode-language-pack-de|MS-|1.62.4 remote-containers|ms-|0.205.2 remote-ssh|ms-|0.66.1 remote-ssh-edit|ms-|0.66.1 remote-wsl|ms-|0.58.5 vscode-remote-extensionpack|ms-|0.21.0 azure-account|ms-|0.9.11 cpptools|ms-|1.7.1 hexeditor|ms-|1.8.2 node-debug|ms-|1.45.0 node-debug2|ms-|1.43.0 powershell|ms-|2021.10.2 test-adapter-converter|ms-|0.1.4 vscode-js-profile-flame|ms-|0.0.21 vsonline|ms-|1.0.3076 hide-gitignored|npx|1.1.0 vscode-jest|Ort|4.2.1 typescript-mono-repo-import-helper|q|0.0.6 java|red|1.0.0 vscode-sort-json|ric|1.20.0 sort-lines|Tyr|1.9.0 vscodeintellicode|Vis|1.2.14 vscode-java-debug|vsc|0.36.0 vscode-java-dependency|vsc|0.18.8 vscode-java-pack|vsc|0.18.6 vscode-java-test|vsc|0.32.0 vscode-maven|vsc|0.34.1 vscode-icons|vsc|11.7.0 vscode-todo-highlight|way|1.0.5
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 dockerwalkthru:30377721 bridge0723:30353136 pythonrunftest32:30373476 pythonf5test824:30373475 javagetstartedt:30391933 pythonvspyt187:30373474 vsqsis400:30386382 vsaa593:30376534 vssld246cf:30401891 ```
lszomoru commented 2 years ago

@AlCalzone, sorry for not getting back to you on this until now. Couple of questions:

  1. Were those remotes ever present in the repository? If so, were the branches deleted on the remote? Was the remote deleted?
  2. Could you please share the value of the git.checkoutType setting? Is it set to ["local", "remote", "tags"]?
  3. To rule out any extension, are you able to reproduce the issue when you start VS Code with code --disable-extensions?
AlCalzone commented 2 years ago

Were those remotes ever present in the repository?

Yes

If so, were the branches deleted on the remote? Was the remote deleted?

The remote came from locally checking out a pull request from a contributor. I removed the remote from my local repository (and deleted all local branches). The remote on Github still exists, but the branch that contained the PR commits doesn't any longer.

Is it set to ["local", "remote", "tags"]?

Yes

code --disable-extensions

Still there.

lszomoru commented 2 years ago

@AlCalzone, thank for the update. Will take a look at this today and will update the issue with my findings.

lszomoru commented 2 years ago

@AlCalzone sorry for not getting back to you until now. Could you please try couple of things in order to track down the issue:

  1. Could you please run the following command git for-each-ref refs/remotes/AlexCPU and see if it returns anything?
  2. Could you please run the following command git for-each-ref and see if it returns any of the remotes
  3. Could you please update the git.checkoutType setting to ["local", "tags"]and see if the items are still being included in the quick pick.
AlCalzone commented 2 years ago

@lszomoru I'm afraid I can't reproduce anymore.

In the meantime another PR from the problematic remote was opened, I checked it out locally with the Github extension and then removed the remote again when done.

Now the entries no longer appear in the list. Commands 1 and 2 also return no reference, but I guess this is expected.

lszomoru commented 2 years ago

@AlCalzone thanks for the update. Based on your update I will go ahead and close this issue. Please feel free to reopen it in case you run into this issue again. Thanks!