pub struct Repository { /* private fields */ }
Expand description

The main repository object.

This wrapper allows to keep track of optional git-dir and work-tree directories when executing commands. This functionality was needed for glv & git-stree project.

Implementations

Getters

Panics

Panics of executing git-diff(1) fails

Panics

Panics of executing git-rev-parse(1) fails

Returns a HashMap of git remotes

Returns the HEAD commit id if ref HEAD exists

Panics

Panics when fails to resolve HEAD

Return path to git WORK_TREE

TODO move to generic repo trait TODO Remove optional

Return true if the repo is sparse

Errors

Will return InvalidRefError if invalid reference provided

Constructors

Errors

Will return RepoError when fails to find repository

Errors

Will return RepoError when fails to find repository

Panics

When git execution fails

Errors

Returns a string output when something goes horrible wrong

Errors

Will return RepoError when fails to find repository

Functions

Return config value for specified key

Errors

See CommitError

Panics

When git-commit(1) fails to execute

Read file from workspace or use git-show(1) if bare repository

Panics

When UTF-8 encoding path fails

Errors

When fails throws std::io::Error TODO move to generic repo trait

Returns true if the first commit is an ancestor of the second commit.

Errors

When fails will return a String describing the issue.

Panics

When git-sparse-checkout(1) execution fails

Errors

See StagingError

Panics

Panics if fails to execute git-add(1)

Stash staged, unstaged and untracked files (keeps ignored files).

Errors

See StashingError

Pop stashed changes

Errors

See StashingError

Errors

Fails if current repo is bare or dirty. In error cases see the provided string.

Panics

When git-subtree(1) execution fails

Errors

Fails if current repo is bare or dirty. In error cases see the provided string.

Panics

When git-subtree(1) execution fails

Errors

Fails if current repo is bare or dirty. In error cases see the provided string.

Panics

When git-subtree(1) execution fails

Errors

Fails if current repo is bare. In other error cases see the provided message string.

Commit Functions

Find best common ancestor between to commits.

Errors

Will return InvalidCommitishError::Multiple when one or multiple provided ids do not exist

Panics

When exit code of git-merge-base(1) is not 0 or 128

Returns a prepared git Command struct TODO move to generic repo trait

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.