Documentation ¶
Index ¶
- func CanonicalRepoURL(repoURL string) (string, error)
- type Client
- func (c *Client) Clone() *Client
- func (c *Client) CurrentBranch() (string, error)
- func (c *Client) Dir() string
- func (c *Client) ListFiles() ([]string, error)
- func (c *Client) ListRemotes() (Remotes, error)
- func (c *Client) ListTags() ([]sous.Tag, error)
- func (c *Client) ListUnpushedCommits() ([]string, error)
- func (c *Client) ModifiedFiles() ([]string, error)
- func (c *Client) NearestTag() (string, error)
- func (c *Client) NewFiles() ([]string, error)
- func (c *Client) OpenRepo(dirpath string) (*Repo, error)
- func (c *Client) RepoRoot() (string, error)
- func (c *Client) Revision() (string, error)
- func (c *Client) RevisionAt(ref string) (string, error)
- type Remote
- type Remotes
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalRepoURL ¶
Types ¶
type Client ¶
type Client struct { // Sh is the *shell.Sh instance this client uses for all shell interaction. Sh *shell.Sh // Bin is the path to the git binary. This defaults to "git", therefore // relying that git is in the path. Bin string // Version is the version of git at Bin. Version semv.Version }
Client is a git client that shells out to locally installed git. It requires that git is in the path by default, although you can override that by setting the Bin field to a path to a different Git. Client is used to perform git commands within a particular directory, determined by its shell.Sh instance.
func NewClient ¶
NewClient returns a git client, as long as `git --version` succeeds. The *shell.Sh is used for all commands. The client created by this func uses git in your path.
func NewClientInVersionRange ¶
NewClientInVersionRange is similar to NewClient, but returns nil and and error if the version of the installed git client is not in the specified range.
func (*Client) CurrentBranch ¶
func (*Client) ListRemotes ¶
func (*Client) ListUnpushedCommits ¶
ListUnpushedCommits returns a list of commit sha1s for commits that haven't been pushed to any remote
func (*Client) ModifiedFiles ¶
func (*Client) NearestTag ¶
type Repo ¶
type Repo struct { // Root is the root dir of this repo Root string // Client is a git client inside this repo. Client *Client }
Repo is a git repository.
func NewRepo ¶
NewRepo takes a client, which it expects to already be inside a repo directory. It returns an error if the client is not inside a repository or if it fails to determine that fact. Note that it can be anywhere in a repository, it doesn't need to be in the root.
func (*Repo) SourceContext ¶
SourceContext gathers together a number of bits of information about the repository such as its current branch, revision, nearest tag, nearest semver tag, etc.