Skip to content

Build script can no longer initialize git submodules #1248

Closed
@oakes

Description

@oakes

I have a submodule in my project, and for my users' convenience I made the build script automatically initialize it like this:

let curr_dir = Path::new(os::getenv("CARGO_MANIFEST_DIR").unwrap());
Command::new("git").arg("submodule").arg("update").arg("--init").cwd(&curr_dir).status().unwrap();

This no longer works. If I try running cargo build in my project without initializing the submodule manually, it just fails with "An unknown error occurred". With the --verbose flag, it complains that it "Failed to resolve path '/my/submodule/path/.git': No such file or directory".

This error occurs even if the build script is empty! It seems like Cargo is trying to do something with git submodules before the build script even runs. Was this a recent change, and is there a workaround I can use? Requiring users to manually init my submodule would be very inelegant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions