Output ptr to submodule; pass null to just get return code
The parent repository
The name of or path to the submodule; trailing slashes okay
0 on success, git_error_code.GIT_ENOTFOUND if submodule does not exist, git_error_code.GIT_EEXISTS if a repository is found in working directory only, -1 on other errors.
Lookup submodule information by name or path.
Given either the submodule name or path (they are usually the same), this returns a structure describing the submodule.
There are two expected error scenarios:
- The submodule is not mentioned in the HEAD, the index, and the config, but does "exist" in the working directory (i.e. there is a subdirectory that appears to be a Git repository). In this case, this function returns git_error_code.GIT_EEXISTS to indicate a sub-repository exists but not in a state where a git_submodule can be instantiated. - The submodule is not mentioned in the HEAD, index, or config and the working directory doesn't contain a value git repo at that path. There may or may not be anything else at that path, but nothing that looks like a submodule. In this case, this returns git_error_code.GIT_ENOTFOUND.
You must call git_submodule_free when done with the submodule.