Skip to content

Submodules with relative paths #7992

Closed
@gliderkite

Description

@gliderkite

I have a crate base in a git repository hosted in GitLab that uses submodules, and none of this submodules are actually necessary to cargo build the crate:

[submodule "deployment"]
	path = deployment
	url = ../../backend/deployment.git

Please nothe the use of a relative url, since GitLab requires it.

I also have another crate super that needs to have base as a dependency. Normally I'll add my dependency in the Cargo.toml of super with:

base = { git = "ssh://gitlab.example.com/backend/base" }

Unfortunately this raises the following error when I run cargo update or try to build the project:

error: failed to load source for a dependency on `base`

Caused by:
  Unable to update ssh://gitlab.example.com/backend/base

Caused by:
  failed to update submodule `deployment`

Caused by:
  failed to fetch submodule `deployment` from ../../backend/deployment.git

Caused by:
  unsupported URL protocol; class=Net (12)

I guess the problem is the relative path of the submodule, so as workaround for now I add to super a new submodule pointing to base and I specify its local path in the Cargo.toml:

base = { path = "base" }
  • Is there a way to use relative paths for submodules and avoid this error?
  • Since I don't actually need the submodules to build base, is there a way to tell cargo to skip fetching the submodules of base?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions