Struct git_repository::Repository[][src]

pub struct Repository {
    pub refs: RefStore,
    pub work_tree: Option<PathBuf>,
    // some fields omitted
}
Expand description

A instance with access to everything a git repository entails, best imagined as container for most for system resources required to interact with a git repository which are loaded in once the instance is created.

These resources are meant to be shareable across threads and used by most using an Easy* type has a handle carrying additional in-memory data to accelerate data access or hold volatile data. Depending on context, EasyShared gets the fastest read-only access to the repository, whereas Easy has to go through an Rc and EasyArcExclusive through an Arc<RwLock>.

Namely, this is an object database, a reference database to point to objects.

Fields

refs: RefStore

A store for references to point at objects

work_tree: Option<PathBuf>

The path to the worktree at which to find checked out files

Implementations

Return the kind of repository, either bare or one with a work tree.

Open a git repository at the given path, possibly expanding it to path/.git if path is a work tree dir.

Create a repository with work-tree within directory, creating intermediate directories as needed.

Fails without action if there is already a .git repository inside of directory, but won’t mind if the directory otherwise is non-empty.

The path to the .git directory itself, or equivalent if this is a bare repository.

Return the path to the repository itself, containing objects, references, configuration, and more.

Synonymous to path().

Return the path to the working directory if this is not a bare repository.

Return the path to the directory containing all objects.

Try to open a git repository in directory and search upwards through its parents until one is found.

Which Easy is for me?

For one-off commands and single-threaded applications, use EasyShared or Easy as they don’t allow mutable repository access which won’t be needed.

When multiple threads are involved, use EasyArc instead.

Finally, if there is the need for adapting to changed object packs on disk or working with namespaces, mutable Repository access is needed, as provided by EasyArcExclusive. Currently mutable shared access is only available in thread-save versions, but that shall be fixed in the future as Rust’s support for GATs becomes stable.

Transform this instance into an EasyShared with borrowed Repository.

Since a standard reference is used, the repository can never be mutated, which is required for the fewest operations.

Transform this instance into an Easy, offering shared immutable access to the repository, for the current thread.

Transform this instance into an EasyArc, offering shared immutable access to the repository for use across threads.

Transform this instance into an EasyArcExclusive, offering shared immutable access to the repository for use across threads.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

The type returned in the event of a conversion error.

Performs the conversion.

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. 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.