Struct git2::Submodule[][src]

pub struct Submodule<'repo> { /* fields omitted */ }
Expand description

A structure to represent a git submodule

Implementations

Get the submodule’s branch.

Returns None if the branch is not valid utf-8 or if the branch is not yet available.

Get the branch for the submodule.

Returns None if the branch is not yet available.

Get the submodule’s url.

Returns None if the url is not valid utf-8 or if the URL isn’t present

Get the url for the submodule.

Returns None if the URL isn’t present

Get the submodule’s name.

Returns None if the name is not valid utf-8

Get the name for the submodule.

Get the path for the submodule.

Get the OID for the submodule in the current HEAD tree.

Get the OID for the submodule in the index.

Get the OID for the submodule in the current working directory.

This returns the OID that corresponds to looking up ‘HEAD’ in the checked out submodule. If there are pending changes in the index or anything else, this won’t notice that.

Copy submodule info into “.git/config” file.

Just like “git submodule init”, this copies information about the submodule into “.git/config”. You can use the accessor functions above to alter the in-memory git_submodule object and control what is written to the config, overriding what is in .gitmodules.

By default, existing entries will not be overwritten, but passing true for overwrite forces them to be updated.

Open the repository for a submodule.

This will only work if the submodule is checked out into the working directory.

Reread submodule info from config, index, and HEAD.

Call this to reread cached submodule information for this submodule if you have reason to believe that it has changed.

If force is true, then data will be reloaded even if it doesn’t seem out of date

Copy submodule remote info into submodule repo.

This copies the information about the submodules URL into the checked out submodule config, acting like “git submodule sync”. This is useful if you have altered the URL for the submodule (or it has been altered by a fetch of upstream changes) and you need to update your local repo.

Add current submodule HEAD commit to index of superproject.

If write_index is true, then the index file will be immediately written. Otherwise you must explicitly call write() on an Index later on.

Resolve the setup of a new git submodule.

This should be called on a submodule once you have called add setup and done the clone of the submodule. This adds the .gitmodules file and the newly cloned submodule to the index to be ready to be committed (but doesn’t actually do the commit).

Update submodule.

This will clone a missing submodule and check out the subrepository to the commit specified in the index of the containing repository. If the submodule repository doesn’t contain the target commit, then the submodule is fetched using the fetch options supplied in opts.

init indicates if the submodule should be initialized first if it has not been initialized yet.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.