git

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package git provides a client for interacting with Git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client defines the client to interact with git repositories.

func NewClient

func NewClient(exec process.Shell) *Client

NewClient creates a new Client instance with the provided shell to interact with git repositories.

func (*Client) CommitMessage

func (c *Client) CommitMessage(
	ctx context.Context,
	hash commit.Hash,
) (commit.Message, error)

CommitMessage retrieves the commit message for a given commit hash.

Returns error if the hash is empty or if the git command execution fails or if the context is canceled.

func (*Client) Commits

func (c *Client) Commits(
	ctx context.Context,
	hash commit.Hash,
) ([]commit.Commit, error)

Commits retrieves a list of commits reachable from the current HEAD that are not reachable from the specified hash (i.e. commits after `hash`, exclusive).

Returns error if the hash is empty or if the git command execution fails or if the context is canceled.

func (*Client) CurrentBranch

func (c *Client) CurrentBranch(
	ctx context.Context,
) (branch.Branch, error)

CurrentBranch retrieves the current branch or returns an error if the git command execution fails.

func (*Client) MergeBase

func (c *Client) MergeBase(
	ctx context.Context,
	target string,
	curr string,
) (commit.Hash, error)

MergeBase retrieves the merge base commit hash between two specified commits or branches.

For example, it can be used to find the common ancestor of two branches and/or commits in a Git repository.

Returns an error if the git command execution fails or if the context is canceled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL