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

Gitlens for submodules #58

Closed
thiagoh opened this issue Mar 31, 2017 · 35 comments
Closed

Gitlens for submodules #58

thiagoh opened this issue Mar 31, 2017 · 35 comments
Assignees
Labels
bug Something isn't working

Comments

@thiagoh
Copy link

thiagoh commented Mar 31, 2017

I noticed gitlens doesn't work for submodules. When you have a project and inside it you have one or more submodules, gitlens completely ignore them.

Do you plan to implement this functionality by chance?

@eamodio eamodio added the needs-more-info Needs further information, steps, details, etc. label Mar 31, 2017
@eamodio
Copy link
Member

eamodio commented Mar 31, 2017

I've never used submodules myself, so I'm not familiar with them. I did a bunch of work a while back to support sub-repos (and I think that still works, though I believe I noticed a bug the other day). When you say that it just ignores them, what does that mean exactly? You could also try turning on the output logging via "gitlens.output.level": "verbose" setting and see if there are any error messages there.

@thiagoh
Copy link
Author

thiagoh commented Mar 31, 2017

There isn't any error message coming. Only a warning like this:
"Unable to show commit details. File is probably not under source control" when I, for example, try to use "Show commit details" on a file that is under the submodule.

When I say that gitlens ignores it I mean that the extension doesn't work at all on a file versioned by a submodule.

@eamodio
Copy link
Member

eamodio commented Mar 31, 2017

That warning should generate a much better message in the GitLens output channel if you turn set "gitlens.output.level": "verbose". Can you turn that on, and retry? Then post the logs here?

@thiagoh
Copy link
Author

thiagoh commented Mar 31, 2017

@eamodio I did this configuration then under the output tab nothing is shown. Is the any other thing I could do?

@eamodio
Copy link
Member

eamodio commented Mar 31, 2017

Sorry I gave you the wrong setting, its "gitlens.advanced.output.level": "verbose" -- that's what I get for not looking it up first.

@thiagoh
Copy link
Author

thiagoh commented Mar 31, 2017

Now we go! =)

This happens when, for example, I open a file tfsa-directives.js which is under the submodule.

CodeLens config changed; resetting CodeLens provider
Triggering a reset of the git CodeLens provider
getBlameForFile('/data/dev/wpd', '/data/dev/wpd/src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js', undefined)
Add blame cache for '/data/dev/wpd/src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js'
git blame --root --incremental -- src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js   cwd='/data/dev/wpd' 
  Error: fatal: no such path 'src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js' in HEAD  Failed with exit code: 128
getBlameForFile('/data/dev/wpd', '/data/dev/wpd/src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js', undefined)
getBlameForFile('/data/dev/wpd', '/data/dev/wpd/src/main/resources/templates/phn/html/js/dashboard/accounts/tfsa-directives.js', undefined)

@eamodio eamodio self-assigned this Mar 31, 2017
@eamodio eamodio added bug Something isn't working and removed needs-more-info Needs further information, steps, details, etc. labels Mar 31, 2017
@eamodio
Copy link
Member

eamodio commented Mar 31, 2017

@thiagoh thanks for the output -- I think I broke this in one of the more recent updates :(

I'll look into fixing it

@thiagoh
Copy link
Author

thiagoh commented Mar 31, 2017

Thank you @eamodio
Tell me if you need some help with that..

@eamodio
Copy link
Member

eamodio commented Apr 1, 2017

@thiagoh do you happen to have a repo that has a submodule that I can clone to test with?

@thiagoh
Copy link
Author

thiagoh commented Apr 1, 2017

@eamodio, unfortunately the repo with submodules I use is private. However, if you could create one repo with submodules to test you'll see that is quite simple:

Take these examples:

@eamodio
Copy link
Member

eamodio commented Apr 1, 2017

@thiagoh could you try a test with this: gitlens-3.1.1.zip

To install it first rename it to gitlens-3.1.1.vsix, then make sure to uninstall the current version of GitLens from vs code (and reload), then use the Install from VSIX... menu choice from the ... extensions menu.

@eamodio eamodio closed this as completed in d3af67b Apr 1, 2017
@eamodio eamodio reopened this Apr 1, 2017
@thiagoh
Copy link
Author

thiagoh commented Apr 3, 2017

@eamodio I'm sorry for the delay..

Look, when I tried to install from the .vsix file I got the following error

end of central directory record signature not found

@eamodio
Copy link
Member

eamodio commented Apr 4, 2017

@thiagoh Not sure what happened there -- very odd. But I've just published v3.2.0 to the marketplace -- please try that out and let me know if it works for you. Thanks!

@thiagoh
Copy link
Author

thiagoh commented Apr 4, 2017

@eamodio working perfectly! thank you so much!

@eamodio
Copy link
Member

eamodio commented Apr 4, 2017

@thiagoh excellent news! Closing this out then :)

@eamodio eamodio closed this as completed Apr 4, 2017
@cassmtnr
Copy link

Hey @thiagoh, how are you seeing the submodules?

I don't see my submodule, I just see this:

alt text

@vladipus
Copy link

vladipus commented Jun 5, 2018

These don't work for me either. I think you should reopen the issue.

@eamodio
Copy link
Member

eamodio commented Jun 5, 2018

@vladipus Can you provide more details to the structure of your project (hierarchy of where the git repo is and the submodules)? Or if its an open source repo, point me to it?

@akaralar
Copy link

I'm having the same problem. I have created an example repository with 3 submodules, similar to my setup. If you navigate to history of the master branch from gitlens explorer view, you can see changes for files that are local to the repo, but if you pulled new changes for submodules and commit the submodule updates, you can not see the changes for those files under the submodules. VSCode gives the error "Unable to open compare. See output channel for more details", which says

> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git

@eamodio eamodio reopened this Jul 28, 2018
@eamodio eamodio added this to the Backlog milestone Jul 29, 2018
@andygikling
Copy link

Bump,
Git submodules are super common these days.
Is anyone working on this right now?

@eamodio
Copy link
Member

eamodio commented Dec 10, 2018

@andygikling Have you tried with GitLens 9? And if so, can you detail what isn't working that you expect to be working? Thanks!

@andygikling
Copy link

First of all I love what Gitlens is all about. I looked closer at it. There are two main problems.

The first issue is yes it shows submodules but it doesn't recuse the folder tree looking for more. It only shoes submodules for git directories directly below the current VS code active folder. Maybe this is intended though.

My repo structure looks like this:

-GitRepoMaster
----NormalCodeFolder
----GitSubmodule1
----GitSubmodule2
----GitSubmodule3
--------GitSubmodule3.1
--------GitSubmodule3.2

And on the treeview in Gitlense is see this:

-GitRepoMaster
----GitRepoMaster (GitSubmodule1)
----GitRepoMaster (GitSubmodule2)
----GitRepoMaster (GitSubmodule3)

But I suppose I expected to see this (more per SmartGit and Kracken):

-GitRepoMaster
----GitSubmodule1
----GitSubmodule2
----GitSubmodule3
--------GitSubmodule3.1
--------GitSubmodule3.2

Note the way the names look is different - () is missing and the tree should show a physical indentation.
And you show all the submodules.

Let me know what you think @eamodio

@eamodio
Copy link
Member

eamodio commented Dec 11, 2018

@andygikling Thanks! You can control the depth that GitLens searches for repositories by default by changing the gitlens.advanced.repositorySearchDepth setting. It currently defaults to 1 for performance reasons. Also, GitLens should automatically discover new repositories as you open new files from those repos.

Let me know if that works for you.

As for the naming -- I went with that structure to mirror the workspace folders you have open in vscode, although if you have only 1 workspace folder open then maybe that structure is overkill. I'll have to look into that a bit more.

@andygikling
Copy link

Fantastic! Well done sir. Sorry I didn't know about the search depth option!

Naming decision makes sense. Thank you.

@eamodio
Copy link
Member

eamodio commented Dec 12, 2018

No worries at all (GitLens has LOTS of options 😄).

Do you think this issue can be closed then?

@andygikling
Copy link

Of course! Thank you.

@eamodio eamodio closed this as completed Dec 13, 2018
billsedison added a commit to noside911/vscode-gitlens that referenced this issue Jan 4, 2019
@brianjmurrell
Copy link

Does the default of 1 for gitlens.advanced.repositorySearchDepth mean that it searches for submodules at the first level in a git repo? i.e. if I have a submodule at the root of my git repo, it should find it? For me, the submodule was not found until i opened a file in it even though it's at the root of my git repo.

@brianjmurrell
Copy link

Lol. I increased it to 2 and it found the git repos that were at depth 2 but not the one at depth 1.

@Awbmilne
Copy link

Awbmilne commented Apr 17, 2020

Bump,

I have been having issues with this as well. GitLens only recognized the Master git repo initially.

Main Git Repo
|--File_Directory
|--SubModule A
|--SubModule B
|--SubModule C
|--SubModule C-1
|--SubModule D

I am able to get GitLens to recognize the submodules (including the nested one) If open files in each submodule. After VScode reloads though, they are gone and I have to open a file again.

I have tried the gitlens.advanced.repositorySearchDepth, but it hasnt changed anything (varied from 1 to 4).

@YoniChechik
Copy link

I'm using subrepos inside the main git repo and can't see my subrepos as well, regardless of gitlens.advanced.repositorySearchDepth

@ramusz1
Copy link

ramusz1 commented May 10, 2020

For me, the submodule was not found until i opened a file in it even though it's at the root of my git repo.

This worked for me, thanks.

@brianjmurrell
Copy link

@ramusz1 To be clear, though, that is just a work-around. IMHO, the plugin should see all submodules without one having to navigate to one and open a file in one.

@brianjmurrell
Copy link

But if people are still seeing this, like @ramusz1 apparently is, why is this issue closed?

@cosmikwolf
Copy link

I also continue to experience this problem, with gitlens 10.2.2 on platformio. It sometimes works, and sometimes doesnt. Not sure why it starts and stops. I had a code review the other day, and all of a sudden my subrepos disappeared and I was SOL. it was really frustrating.

Could gitlens just look at the .gitmodules file to see where submodules should be?
Or could we specify paths to submodules inside of our workspace settings?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2020
@eamodio eamodio removed this from the Backlog milestone Dec 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests