Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git diff view does not show untracked nested repositories, but will commit them #71593

Closed
1 task done
kryops opened this issue Apr 2, 2019 · 3 comments
Closed
1 task done
Assignees
Labels
git GIT issues

Comments

@kryops
Copy link

kryops commented Apr 2, 2019

Issue Type: Bug

VS Code does not show untracked nested Git repositories it in the "Source Control" panel's diff view, but will add them to a commit using the "Commit" button, or stage them using the "Stage All Changes" button.

In my case I wanted to add an external repository into my yarn workspace for development, but added it to my .gitignore incorrectly, which made me accidentally commit it because it did not show up in VS Code's diff view.

Steps to reproduce:

  • Clone a Git repository and open it in VS Code
  • Optional: Make changes to a file
  • Clone a nested repository into a subfolder

Expected result:

  • The "Source Control" view shows both the edited file and the untracked nested repository

Actual result:

  1. Only the changes to the edited file are displayed in the "Source Control" view

image

  1. When committing all changes by pressing the "Commit" button at the top of the "Source Control" view, the nested repository is committed as well
> git diff HEAD^1

...

diff --git a/packages/test b/packages/test
new file mode 160000
index 000000000..edcb146c9
--- /dev/null
+++ b/packages/test
@@ -0,0 +1 @@
+Subproject commit edcb146c9d9904038f83a7020a802cd6b8212d3b
  1. Only after the nested repository is committed, The "Source Control" view starts displaying changes made to it

image

Side Notes:

  • The nested repository is displayed in the "Staged Changes" diff view when the "Stage All Changes" button is clicked or it is added via git add through the shell. This bug only seems to affect nested repositories that are untracked.
  • The Git command line warns about adding nested repositories that are not proper submodules. Maybe VS Code should add a warning in these cases as well?
> git add packages/test

warning: adding embedded git repository: packages/test
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: 
hint:   git submodule add <url> packages/test
hint: 
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: 
hint:   git rm --cached packages/test
hint: 
hint: See "git help submodule" for more information.

Related: #37947

VS Code version: Code 1.32.3 (a3db5be, 2019-03-14T22:46:48.547Z)
OS version: Darwin x64 18.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz (8 x 2300)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (4.18GB free)
Process Argv -psn_0_77843
Screen Reader no
VM 0%
  • Tried with extensions disabled
@vscodebot
Copy link

vscodebot bot commented Apr 2, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the git GIT issues label Apr 2, 2019
@kryops
Copy link
Author

kryops commented Apr 2, 2019

(not a duplicate as this issue is not about showing the nested repository as a SCM provider, but rather the diff it causes to the parent repository)

@joaomoreno
Copy link
Member

#37947

@vscodebot vscodebot bot locked and limited conversation to collaborators May 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
git GIT issues
Projects
None yet
Development

No branches or pull requests

2 participants