ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.25k stars 359 forks source link

Option to skip cloning git submodules during opam installation of dependecies #6260

Open filipeom opened 3 weeks ago

filipeom commented 3 weeks ago

From this comment, I gather that opam automatically checks out submodules when it detects a .gitmodules file during the initial setup of the installation process:

https://github.com/ocaml/opam/blob/f0ba0c2fb1145fc596c9cf6d997db7d91e36c432/src/repository/opamGit.ml#L178-L180

However, in my case, I want to handle submodules manually since they are not needed during the build process. This is causing issues in our CI, as the submodules we include are quite large, leading to CI failures.

To fix my issue, I’ve been removing the .git directory during the initial CI setup. However, this workaround introduces undesired behavior in another CI workflow.

I believe there is currently no way in opam to disable the behavior of fetching submodules when a .gitmodules file is present during a call to opam install . --deps-only. Could we add a flag, such as --ignore-git-submodules, to give users control over this behavior? Or would this cause futher issues I'm not aware?

Thanks in advance!

kit-ty-kate commented 2 weeks ago

To fix my issue, I’ve been removing the .git directory during the initial CI setup. However, this workaround introduces undesired behavior in another CI workflow.

What about simply removing the .gitmodules then committing instead? This should get rid of the issue and avoid the unwanted submodule fetching.

filipeom commented 2 weeks ago

What about simply removing the .gitmodules then committing instead? This should get rid of the issue and avoid the unwanted submodule fetching.

Yes for my use-case this fixes the issue :smiley: