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

Global submodules view #3306

Closed
vikulikov opened this issue Feb 4, 2024 · 5 comments · Fixed by #3341
Closed

Global submodules view #3306

vikulikov opened this issue Feb 4, 2024 · 5 comments · Fixed by #3341
Labels
enhancement New feature or request

Comments

@vikulikov
Copy link

Describe the solution you'd like
It would be great if submodules tab could show all submodules of the current project recursively. Not only submodules of the current context, but also submodules of submodules, etc. As one list

@vikulikov vikulikov added the enhancement New feature or request label Feb 4, 2024
@stefanhaller
Copy link
Collaborator

I agree that this could be useful, but it's a bit tricky to do. Here's a hacky commit that provides the basics if you want to try it; no PR yet, as this is not really good enough yet.

Problems:

  • showing the nested submodules only works once the submodules are checked out. The reason is that lazygit parses the .gitmodules file to determine which submodules exist. That's probably an acceptable limitation in practice.
  • entering a submodule works, and that's probably the functionality that you're expecting most (I guess). However, there are other things that you can do to a submodule (remove, update, etc), and those commands can't be done in the top-level repo, so right now they fail with an error message. It would probably be possible to make them work by cd'ing into the directory of the direct parent repo, but I haven't done that yet.
  • submodules have a name and a path; constructing the nested path is straightforward, but the name needs to be synthesized somehow. In the commit referenced above I chose to do that in the same way as the path, by joining the parent name and the nested name with a /. I'm not sure that's good though, as it blurs the difference between name and path even more (many people have trouble understanding the difference, it seems).

@vikulikov Let me know if this is going into a direction that you find useful.

@vikulikov
Copy link
Author

I think yes, it is. There is also a git command that lets you run arbitrary commands on every submodule in the project recursively (git submodule foreach --recursive '<your command>'). Can it be useful for this feature? Maybe it can let you rid of the file parsing

@stefanhaller
Copy link
Collaborator

I know, but it's too slow for our purpose, because it spawns a shell process for every submodule; especially on Windows, where forking subprocesses is expensive.

@stefanhaller
Copy link
Collaborator

@vikulikov Here's a PR: #3341. Can you please test it?

@vikulikov
Copy link
Author

Great! It works perfectly

stefanhaller added a commit that referenced this issue Mar 7, 2024
- **PR Description**

Extend the submodules tab to show not only the top-level submodules, but
also their nested submodules, recursively.

Fixes #3306.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants