git_submodule_add_setup

Set up a new git submodule for checkout.

This does "git submodule add" up to the fetch and checkout of the submodule contents. It preps a new submodule, creates an entry in .gitmodules and creates an empty initialized repository either at the given path in the working directory or in .git/modules with a gitlink from the working directory to the new repo.

To fully emulate "git submodule add" call this function, then open the submodule repo and perform the clone step as needed (if you don't need anything custom see git_submodule_add_clone()). Lastly, call git_submodule_add_finalize() to wrap up adding the new submodule and .gitmodules to the index to be ready to commit.

You must call git_submodule_free on the submodule object when done.

extern (C) nothrow @nogc
int
git_submodule_add_setup

Parameters

out_ libgit2_d.types.git_submodule**

The newly created submodule ready to open for clone

repo libgit2_d.types.git_repository*

The repository in which you want to create the submodule

url const(char)*

URL for the submodule's remote

path const(char)*

Path at which the submodule should be created

Should workdir contain a gitlink to the repo in .git/modules vs. repo directly in workdir.

Return Value

Type: int

0 on success, git_error_code.GIT_EEXISTS if submodule already exists, -1 on other errors.

Meta