exec

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exec is the GitClient that runs the git binary through a CommandRunner.

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 runs git.

func New

func New(runner interfaces.CommandRunner) *Client

New returns the Client over runner. It does no I/O.

func (*Client) ChangedSince

func (c *Client) ChangedSince(ctx context.Context, root, base string) ([]string, error)

ChangedSince lists the files changed since the merge base with base.

func (*Client) Diff

func (c *Client) Diff(ctx context.Context, root string, args ...string) ([]byte, error)

Diff returns `git diff args…`.

func (*Client) HasPathsChanged

func (c *Client) HasPathsChanged(
	ctx context.Context,
	root, from, to string,
	paths []string,
) (bool, error)

HasPathsChanged runs `git diff --quiet from to -- paths`; exit 1 means changed.

func (*Client) IsRepo

func (c *Client) IsRepo(ctx context.Context, root string) bool

IsRepo reports whether root is inside a working tree.

func (*Client) LsFiles

func (c *Client) LsFiles(
	ctx context.Context,
	root string,
	pathspecs []string,
) ([]string, error)

LsFiles lists tracked files; outside a repository it returns none.

func (*Client) RemoteHasRef added in v0.0.22

func (c *Client) RemoteHasRef(
	ctx context.Context,
	root, remote, ref string,
) (bool, error)

RemoteHasRef runs `git ls-remote --exit-code --heads --tags remote ref`: exit 0 is a match, exit 2 none, and any other failure a remote that could not be asked.

func (*Client) RevParse

func (c *Client) RevParse(ctx context.Context, root, ref string) (string, error)

RevParse resolves ref; an unknown ref is CodeNotFound.

func (*Client) StageFiles

func (c *Client) StageFiles(ctx context.Context, root string, paths []string) error

StageFiles runs `git add -- paths`; no paths is a no-op.

func (*Client) StagedFiles

func (c *Client) StagedFiles(
	ctx context.Context,
	root string,
	patterns []string,
) ([]string, error)

StagedFiles lists the added, copied or modified staged files matching patterns.

func (*Client) Tag

func (c *Client) Tag(ctx context.Context, root string) (string, error)

Tag returns the tag at HEAD, or "" when HEAD is untagged.

Jump to

Keyboard shortcuts

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