-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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: Support nested git repositories #37947
Comments
Is there any updates about this bug? |
Thank you @javier-moreno-tridonic-com for the procedure in how to circumvent this issue by adding the projects to the workspace in inner->outer order. That helps a lot until this issue is fixed. |
The reverse order works, but screws up intillisense. My python modules from the child folder won't be able to access parent folder package causing all my child package modules to report errors of undefined module. |
Had the same problem. |
Some use cases defy the use of submodules.
…On Thu, 11 Oct 2018, 13:53 zurkoxxx, ***@***.***> wrote:
Had the same problem.
Fixed it by adding nested repository as a submodule (
https://git-scm.com/book/en/v2/Git-Tools-Submodules)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#37947 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATVPqDP4H1nHVvdc94usfZI-QQq4j2uks5ujxUcgaJpZM4QX_sw>
.
|
In all my work, I have nested git repositories that are specifically not submodules, and for this reason: I want the top-level repository to track each sub-level repository via branch, not commit. I made a Python tool, mugit, which uses a manifest file to maintain the relative repository structure, similar to how Google organizes the Android multi-repository structure using their tool, repo. Android Studio is notable for handling nested, non-submodule, multi-git repository structures quite nicely. It would be great if VSCode could do the same. In the mean time, I've been using the GitLens extension for most things, but still for making commits I'm pretty much forced to use another tool completely (e.g. git, git-gui, GitHub Desktop, SourceTree, etc.) to stage commits. I'll be watching this issue with interest. I was disappointed to see there were at least two previous issues filed for this exact same subject, but were closed in the belief that multi-repository support was somehow either already done in some "insider" build (36250) or would somehow ride on the coattails of the multi-folder workspace support (12564). |
+1 for nested git repo support |
Is this still only possible with submodules? @rhymu8354 In that case |
could be a workaround for you... I have created .gitmodules in the root of main repo with a content: Ignore the file in .gitignore, if needed. Its not realy configurated submodule, but VSCode can handle this. Its works recursively to. VS Code v1.30.2 |
@p3t3r5 Thanks for this info! This feels like kind of a hack, but it's a good interim solution until repos in subdirectories are supported. For anyone using this .gitmodules hack with no intention of using submodules, also note that the |
Did you try the solution above where you make a .gitmodules file as though you were going to use submodules but don't actually check it in? It's not ideal but at least it's a one time setup that allows integration of all your git repos |
@benlindsay |
Any news? |
I already mentioned this in #157347, but If you temporarily move the .git folder from your workspace root, then open the workspace, then put the .git folder back, vscode detects all the repositories correctly. Note, this does not work if you do it while the workspace is currently open. It seems to me there is a check that happens when a workspace is opened:
Assuming such a check is actually happening, I think all we need is a configuration option to disable it. |
Ok, this bothered me enough that I decided to spend the afternoon debugging it and I've figured it out. The problem lies within the function The problematic part is this for loop
What is happening here is that the This explains why the submodule "hack" above works, why if you load repositories in reverse order it works, and also why my workaround of removing the parent .git folder and readding afterwards works as well -- as long as you haven't discovered the parent repro before you add the child repro everything works. Now, I'm not exactly sure what the right way to fix this is, but I propose the following change: check if
I'm willing to make a pull request if this solution is not considered horrible @lszomoru. Otherwise, I'm happy to leave it to you to fix "properly". If anyone doesn't want to wait for the fix, you can patch this into your build right away. Here is how to do it: Locate your vscode install and navigate to
This file is optimized so it's a bit tricky to edit. Make sure you are using a decent editor. Look for this bit of code
Patch it by adding this bit into the for loop
Reload your workspace and it should now work the way you expect There is one more thing to consider here, there is a setting that you may also want to double check. By default, vscode will only search 1 folder deep for additional repos. If your repos are deeper, this alone won't fix it, update this setting as well:
|
@nteymory Awesome! The patch seems to work for me. I think a pull request would move any further discussion to the code and could help move this forward; what do you think? |
@nteymory, thank you very much for the investigation. Since the issue has been labeled with |
Sure, PR created: #157812 |
@nteymory is this a git specific solution? I am observing identical behavior using subversion and am hopeful this effort will benefit SVN users as well. |
Unfortunately, yes, it is |
I know that it has been a long time coming, but today's Insiders release (2022-09-08) contains changes to the repository discovery code that detects nested git repositories. Depending on how deep the nested repositories are, one might have to tweak the At the moment we have only tweaked the repository discovery code, but I do expect some additional paper-cuts on the way so I would like to ask you to update to the latest Insiders release, try out this new capability and let us know if you are running into any issues. Thank you very much! |
I tested with the following version:
It worked for me! I had to be setting After changing Thanks for the fix! |
@wesleybl, thanks for testing out the changes.
That is currently expected behaviour. |
@lszomoru installing code-insiders with latest snap on ubuntu 22.04 => works perfectly, all git subfolders detected, inline git diffs show up as expected. Fantastic! |
@hemmingsv, thank you very much for trying out and validating the new functionality. |
With the changes to the repository discovery code checked into main, and slated to be included in the next Stable release, I will go ahead and close this issue. Any other issues that are being discovered with nested git repositories should be handled in separate issues. Thank you all for your help, and for your patience. |
I just tried the nested git repo Initially it did show me the git subfolders but after I reload the vscode it is no more working |
@abhijitchikane, could you please create a separate issue so that we continue the investigation? Thanks! |
Steps to Reproduce:
We use some command line tools from ARM to organise our project. This tools rely on special lib files to establish dependencies between modules. Each module should be an independent repository (git repositories in our case). So once all the references are deployed (the tools will "git clone" the indicated repositories in the lib files) the folder structure would look like this (folders in bold):
If we add project_folder as the root folder, the source control tab will only track the changes done in project_folder.
If we use the new multi-root project feature and also add module1, module2, and module3 to the workspace; we still find that only the changes in project_folder are tracked.
Nevertheless, if we add the folder in an strict reverse nesting order in the following manner:
Then we see that the source control view displays the several source control providers correctly.
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: