Repository: vscode
Issue: Git - Git smart commit commits also sub-repositories, which are normally ignored
Labels: bug,git

Type: <b>Bug</b>

1. Clone a whatever git repo to directory repo1.
2. Clone a whatever git repo to directory repo1/repo2, where repo2 is not git-ignored. It will become a sub-repository, it will be reported separately from the outer repository in the source control view etc. At the same time, the source control view will not show the repo2 dir as a change made to the first repository.
3. Enable the smart commit in the (user) settings - git.enableSmartCommit, with the git.smartCommitChanges setting left at the default "all".
4. Make some changes to files in the first repository.
5. Click the Commit button for the first repository. Thanks to smart commit, the changes will be committed even though they were not staged.

Expected: The repo2 directory is still untracked in repo1, and not committed to it. This is the same behaviour as would be if all the changes were first staged, and then committed.

Actual: The repo2 directory is also committed to the repo1 (as some kind of submodule or something, I'm not sure, but it's definitely there). This is unexpected because the UI never showed to me that it would commit repo2 to repo1. It's also very surprising that it's different than first staging all the changes (which would not stage repo2 as a change to repo1), and only then committing.

VS Code version: Code - Insiders 1.78.0-insider (3ad5774eb8123d4224eb55629df9e5f82fe13b99, 2023-04-14T05:25:56.476Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Sandboxed: Yes
Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|AMD Ryzen 5 2600 Six-Core Processor             (12 x 3400)|
|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: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|15.95GB (3.92GB free)|
|Process Argv|--crash-reporter-id c210250f-2085-4e4b-862c-9745e1e3b74d|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: Debian|
|OS|Linux x64 5.15.90.1-microsoft-standard-WSL2|
|CPUs|AMD Ryzen 5 2600 Six-Core Processor (12 x 3400)|
|Memory (System)|7.74GB (3.04GB free)|
|VM|0%|
</details><details><summary>Extensions (7)</summary>

Extension|Author (truncated)|Version
---|---|---
remote-wsl|ms-|0.78.2
markdown-preview-github-styles|bie|1.0.1
vscode-deno|den|3.17.0
vscode-html-css|ecm|1.13.1
sort-typescript-imports|mic|1.4.1
vscode-docker|ms-|1.24.0
code-spell-checker|str|2.20.4


</details><details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
nodejswelcome1:30587009
pyind779:30611226
pythonsymbol12:30651887
a9j8j154:30646983
6233i204:30659907
functionswalk:30687959
pythonms35:30671666
a2ce3375:30680469
57b77579:30687741
pythonfmttext:30710679
pythonclientmv:30700173
showcppwkth:30715168

```

</details>

<!-- generated by issue reporter -->