question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git.autoRepositoryDetection setting seems to have no effect

See original GitHub issue

Issue Type: Bug

Setting git.autoRepositoryDetection to true, false, subFolders or openEditors seems to have no effect.

After setting git.autoRepositoryDetection to false (for both user and workspace) and then opening a workspace, Visual Studio Code still detects Git repositories from current, parent or subfolders.

VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:40:02.816Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i7-10700K CPU @ 3.80GHz (8 x 3792)
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.92GB (24.82GB free)
crash-reporter-id a836ae33-3ec4-4cfd-b783-0e44ad433173
Screen Reader no
VM 0%
Extensions (28)
Extension Author (truncated) Version
armview ben 0.4.5
doxdocgen csc 1.3.2
vscode-eslint dba 2.2.2
prettier-vscode esb 9.1.0
better-cpp-syntax jef 1.15.10
azure-pipelines ms- 1.195.0
vscode-azureappservice ms- 0.23.0
vscode-azurefunctions ms- 1.6.0
vscode-azureresourcegroups ms- 0.4.0
vscode-azurestorage ms- 0.12.1
vscode-azurevirtualmachines ms- 0.4.1
vscode-bicep ms- 0.4.1124
vscode-cosmosdb ms- 0.18.1
vscode-docker ms- 1.18.0
vscode-dotnet-runtime ms- 1.5.0
vscode-edge-devtools ms- 1.4.2
remote-containers ms- 0.209.6
remote-ssh ms- 0.70.0
remote-wsl ms- 0.63.13
azure-account ms- 0.9.11
azurecli ms- 0.5.0
cmake-tools ms- 1.9.2
cpptools ms- 1.7.1
cpptools-extension-pack ms- 1.1.0
vscode-node-azure-pack ms- 0.2.1
azurerm-vscode-tools msa 0.15.5
cmake twx 0.0.17
vim vsc 1.21.10

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
vscop804:30404766
vscop453:30404998
vsrem710cf:30416617
vsccppwtstudy:30421978

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
negglescommented, Jul 7, 2022

@ak5k, thanks for filing the issue. As of right now, the setting controls scanning repositories that are not in the root workspace folder which is being opened in VS Code. We could probably improve on the documentation but we are also opened to behaviour change. Could you please share your scenario in which you would like to disable repository detection completely? Thank you!

Right. If these settings don’t prevent autodetection of repositories within the workspace, they have pretty misleading names… It would be good to have this laid out explicitly in the documentation somewhere; as far as I’ve been able to find, it’s not. There’s not much in the way of documentation around any of the git config settings…

The inability to prevent the git extension from automatically recursing through every repository in a workspace is utterly infuriating whenever you’re dealing with a repo project or west workspace. Both of these ‘metarepo’ type setups contain ludicrous numbers of repositories, the overwhelming majority of which I am never going to touch. Opening all of them consumes a massive amount of resources, as does constantly watching them for changes.

Even with these workspace settings:

{
    "folders": [
        {
            "name": "west",
            "path": ".."
        },
        {
            "name": "project-1",
            "path": "."
        },
        {
            "name": "project-2",
            "path": "..\\project-2"
        }
    ],
    "settings": {
        "git.detectSubmodules": false,
        "git.repositoryScanMaxDepth": 0,
        "git.autoRepositoryDetection": "subFolders",
        "git.repositoryScanIgnoredFolders": [
            "bootloader",
            "mbedtls",
            "modules",
            "nrf",
            "nrfxlib",
            "test",
            "tools",
            "zephyr"
        ]
}

As well as variants with the full path to the ignored folders, variants with git.ignoredRepositories set to the full path of the repository folders, and variants with autoRepositoryDetection set to anything other than false, every single repo inside the root dir gets opened by the git extension.

Making matters worse, there’s no quick way to close every open repository (or even more than one at once) so I can manually reopen the 1-2 which actually matter. I’d honestly settle for a palette command to close every open repository at this point…

The only other option left is to make the workspace into a multi-root, set git.autoRepositoryDetection to false, and add each of the repos I want to work with as extra workspace folders. This is… clunky, at best. It would be really nice if I could just do this:

{
    "settings": {
        "git.ignoredRepositories": [
            "${workspaceFolder:west}/bootloader",
            "${workspaceFolder:west}/mbedtls",
            "${workspaceFolder:west}/modules",
            "${workspaceFolder:west}/nrf",
            "${workspaceFolder:west}/nrfxlib",
            "${workspaceFolder:west}/test",
            "${workspaceFolder:west}/tools",
            "${workspaceFolder:west}/zephyr"
        ]
    }
}

or conversely, explicitly specify which git repos to open automatically in a folder (whitelist as opposed to blacklist), with something like:

{
    "settings": {
        "git.autoRepositoryDetection": false,
        "git.openRepositories": [
            "${workspaceFolder}/path/to/project-1",
            "${workspaceFolder}/path/to/project-2"
        ]
    }
}

either of these would make dealing with these nightmarishly huge metarepositories (like Zephyr and, well, Android/AOSP) so very very much nicer

1reaction
ak5kcommented, Feb 24, 2022

Hi! In my scenario workspace root (CMake project) is a Git repository, and it has submodules (which in turn have submodules etc). It seems no matter what combination I set for repository and submodule or modification detection, the root repository and its submodules and their modifications are always detected. If it’s meant to work this way when workspace root is a Git repository, then it isn’t really a problem. But if behaviour is to change, I would like the possibility to ignore submodules and/or their modifications and/or the entire root repository itself, even when the VSCode workspace root is also a Git repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code Setting: git.autoRepositoryDetection - YouTube
Want to master VS Code? Click here: https://andrecasal.com/courses/mastery-for-vs-codeWant to upgrade web dev skills?
Read more >
VSCode Flutter - stop tracking Flutter repo changes
In VS Code hit Ctrl+Shift+P · Type and select User Settings · In the search field enter git.AutoRepositoryDetection · select field to false....
Read more >
User and Workspace Settings - Visual Studio Code
These headers only appear when there is more than one provider. ... This setting has no effect on toggling the menu bar with...
Read more >
git-config Documentation - Git
keys may appear in a bundle list file found via the git clone --bundle-uri option. These keys currently have no effect if placed...
Read more >
GitLens — Git supercharged
GitLens is an open-source extension for Visual Studio Code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found