Documentation
¶
Overview ¶
Package git provides a client for interacting with Git repositories.
Index ¶
- type Client
- func (c *Client) CommitMessage(ctx context.Context, hash commit.Hash) (commit.Message, error)
- func (c *Client) Commits(ctx context.Context, hash commit.Hash) ([]commit.Commit, error)
- func (c *Client) CurrentBranch(ctx context.Context) (branch.Branch, error)
- func (c *Client) MergeBase(ctx context.Context, target string, curr string) (commit.Hash, error)
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 ¶
NewClient creates a new Client instance with the provided shell to interact with git repositories.
func (*Client) CommitMessage ¶
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 ¶
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 ¶
CurrentBranch retrieves the current branch or returns an error if the git command execution fails.
func (*Client) MergeBase ¶
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.