Struct branchless::git::Repo[][src]

pub struct Repo { /* fields omitted */ }
Expand description

Wrapper around git2::Repository.

Implementations

Get the Git repository associated with the given directory.

Get the Git repository associated with the current directory.

Open a new copy of the repository.

Get the path to the .git directory for the repository.

Get the path to the directory inside the .git directory which contains state used for the current rebase (if any).

Get the path to the working copy for this repository. If the repository is bare (has no working copy), returns None.

Get the configuration object for the repository.

Get the connection to the SQLite database for this repository.

Get the OID for the repository’s HEAD reference.

Set the HEAD reference directly to the provided oid. Does not touch the working copy.

Detach HEAD by making it point directly to its current OID, rather than to a branch. If HEAD is already detached, logs a warning.

Get the Reference for the main branch for the repository.

Get the OID corresponding to the main branch.

Get a mapping from OID to the names of branches which point to that OID.

The returned branch names include the refs/heads/ prefix, so it must be stripped if desired.

Detect if an interactive rebase has started but not completed.

Git will send us spurious post-rewrite events marked as amend during an interactive rebase, indicating that some of the commits have been rewritten as part of the rebase plan, but not all of them. This function attempts to detect when an interactive rebase is underway, and if the current post-rewrite event is spurious.

There are two practical issues for users as a result of this Git behavior:

  • During an interactive rebase, we may see many “processing 1 rewritten commit” messages, and then a final “processing X rewritten commits” message once the rebase has concluded. This is potentially confusing for users, since the operation logically only rewrote the commits once, but we displayed the message multiple times.

  • During an interactive rebase, we may warn about abandoned commits, when the next operation in the rebase plan fixes up the abandoned commit. This can happen even if no conflict occurred and the rebase completed successfully without any user intervention.

Get the type current multi-step operation (such as rebase or cherry-pick) which is underway. Returns None if there is no such operation.

Find the merge-base between two commits. Returns None if a merge-base could not be found.

Get the file paths which were added, removed, or changed by the given commit.

Get the patch ID for this commit.

Attempt to parse the user-provided object descriptor.

Find all references in the repository.

Check if the repository has staged or unstaged changes. Untracked files are not included. This operation may take a while.

Create a new reference or update an existing one.

Look up a reference with the given name. Returns None if not found.

Get all local branches in the repository.

Look up the branch with the given name. Returns None if not found.

Create a new branch or update an existing branch.

Look up a commit with the given OID. Returns None if not found.

Look up the commit with the given OID and render a friendly description of it, or render an error message if not found.

Create a new commit.

Cherry-pick a commit in memory and return the resulting index.

Look up the tree with the given OID. Returns None if not found.

Write the provided in-memory index as a tree into Git`s object database. There must be no merge conflicts in the index.

Trait Implementations

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Set the foreground color generically Read more

Set the background color generically. Read more

Change the foreground color to black

Change the foreground color to black

Change the foreground color to red

Change the foreground color to red

Change the foreground color to green

Change the foreground color to green

Change the foreground color to yellow

Change the foreground color to yellow

Change the foreground color to blue

Change the foreground color to blue

Change the foreground color to magenta

Change the foreground color to magenta

Change the foreground color to purple

Change the foreground color to purple

Change the foreground color to cyan

Change the foreground color to cyan

Change the foreground color to white

Change the foreground color to white

Change the foreground color to bright black

Change the foreground color to bright black

Change the foreground color to bright red

Change the foreground color to bright red

Change the foreground color to bright green

Change the foreground color to bright green

Change the foreground color to bright yellow

Change the foreground color to bright yellow

Change the foreground color to bright blue

Change the foreground color to bright blue

Change the foreground color to bright magenta

Change the foreground color to bright magenta

Change the foreground color to bright purple

Change the foreground color to bright purple

Change the foreground color to bright cyan

Change the foreground color to bright cyan

Change the foreground color to bright white

Change the foreground color to bright white

Make the text bold

Make the text dim

Make the text italicized

Make the text italicized

Make the text blink

Make the text blink (but fast!)

Swap the foreground and background colors

Hide the text

Cross out the text

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more

Sets the foreground color to an RGB value.

Sets the background color to an RGB value.

Apply a runtime-determined style

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.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.