pub enum Repository {
    Bare {
        git_dir: AbsoluteDirPath,
    },
    Normal {
        git_dir: AbsoluteDirPath,
        work_tree: AbsoluteDirPath,
    },
}
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.

Variants

Bare

Fields

git_dir: AbsoluteDirPath

Normal

Fields

git_dir: AbsoluteDirPath
work_tree: AbsoluteDirPath

Implementations

Getters

Panics

Panics of executing git-diff(1) fails

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

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

Return config value for specified key

Errors

When given invalid key or an invalid config file is read.

Panics

Will panic if git exits with an unexpected error code. Expected codes are 0, 1 & 3.

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

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)

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

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.