Documentation
¶
Overview ¶
Package exec is the GitClient that runs the git binary through a CommandRunner.
Index ¶
- type Client
- func (c *Client) ChangedSince(ctx context.Context, root, base string) ([]string, error)
- func (c *Client) Diff(ctx context.Context, root string, args ...string) ([]byte, error)
- func (c *Client) Grep(ctx context.Context, root, needle string) ([]string, error)
- func (c *Client) HasPathsChanged(ctx context.Context, root, from, to string, paths []string) (bool, error)
- func (c *Client) IsRepo(ctx context.Context, root string) bool
- func (c *Client) Log(ctx context.Context, root string, args ...string) ([]byte, error)
- func (c *Client) LsFiles(ctx context.Context, root string, pathspecs []string) ([]string, error)
- func (c *Client) LsUntracked(ctx context.Context, root string, pathspecs []string) ([]string, error)
- func (c *Client) Move(ctx context.Context, root, from, to string) error
- func (c *Client) RemoteHasRef(ctx context.Context, root, remote, ref string) (bool, error)
- func (c *Client) Remove(ctx context.Context, root string, paths []string) error
- func (c *Client) RevParse(ctx context.Context, root, ref string) (string, error)
- func (c *Client) StageFiles(ctx context.Context, root string, paths []string) error
- func (c *Client) StagedFiles(ctx context.Context, root string, patterns []string) ([]string, error)
- func (c *Client) Status(ctx context.Context, root string, pathspecs []string) ([]byte, error)
- func (c *Client) Tag(ctx context.Context, root string) (string, 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 runs git.
func New ¶
func New(runner interfaces.CommandRunner) *Client
New returns the Client over runner. It does no I/O.
func (*Client) ChangedSince ¶
ChangedSince lists the files changed since the merge base with base.
func (*Client) Grep ¶ added in v0.0.39
Grep runs `git grep -l -z -I -F -e needle`; exit 1 (no match) is none.
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) LsUntracked ¶ added in v0.0.39
func (c *Client) LsUntracked( ctx context.Context, root string, pathspecs []string, ) ([]string, error)
LsUntracked lists the untracked, non-ignored files matching pathspecs.
func (*Client) RemoteHasRef ¶ added in v0.0.22
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) StageFiles ¶
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.