Documentation ¶
Index ¶
- type Branch
- type Checkout
- func (c *Checkout) AddRemote(ctx context.Context, remote, repoUrl string) error
- func (c *Checkout) Cleanup(ctx context.Context) error
- func (c *Checkout) Fetch(ctx context.Context) error
- func (c *Checkout) FetchRefFromRepo(ctx context.Context, repo, ref string) error
- func (c *Checkout) Update(ctx context.Context) error
- type GitDir
- func (g GitDir) Branches(ctx context.Context) ([]*Branch, error)
- func (g GitDir) Details(ctx context.Context, name string) (*vcsinfo.LongCommit, error)
- func (g GitDir) Dir() string
- func (g GitDir) FullHash(ctx context.Context, ref string) (string, error)
- func (g GitDir) GetBranchHead(ctx context.Context, branchName string) (string, error)
- func (g GitDir) GetFile(ctx context.Context, fileName, commit string) (string, error)
- func (g GitDir) Git(ctx context.Context, cmd ...string) (string, error)
- func (g GitDir) IsAncestor(ctx context.Context, a, b string) (bool, error)
- func (g GitDir) NumCommits(ctx context.Context) (int64, error)
- func (g GitDir) RevList(ctx context.Context, args ...string) ([]string, error)
- func (g GitDir) RevParse(ctx context.Context, args ...string) (string, error)
- func (g GitDir) Version(ctx context.Context) (int, int, error)
- type Repo
- type TempCheckout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct { // The human-readable name of the branch. Name string // The commit hash pointed to by this branch. Head string }
Branch describes a Git branch.
type Checkout ¶
type Checkout struct {
GitDir
}
Checkout is a struct used for managing a local git checkout.
func NewCheckout ¶
NewCheckout returns a Checkout instance based in the given working directory. Uses any existing checkout in the given directory, or clones one if necessary. In general, servers should use Repo instead of Checkout unless it is absolutely necessary to have a working copy.
func (*Checkout) AddRemote ¶
AddRemote checks to see if a remote already exists in the checkout, if it exists then the URL is matched with the repoURL. If the remote does not exist then it is added.
func (*Checkout) Cleanup ¶
Cleanup forcibly resets all changes and checks out the master branch at origin/master. All local changes will be lost.
func (*Checkout) FetchRefFromRepo ¶
FetchRefFromRepo syncs the specified ref from the repo without modifying the working copy.
type GitDir ¶
type GitDir string
GitDir is a directory in which one may run Git commands.
func (GitDir) Details ¶
Details returns a vcsinfo.LongCommit instance representing the given commit.
func (GitDir) GetBranchHead ¶
GetBranchHead returns the commit hash at the HEAD of the given branch.
func (GitDir) IsAncestor ¶
IsAncestor returns true iff A is an ancestor of B.
func (GitDir) NumCommits ¶
NumCommits returns the number of commits in the repo.
type Repo ¶
type Repo struct {
GitDir
}
Repo is a struct used for managing a local git repo.
func NewRepo ¶
NewRepo returns a Repo instance based in the given working directory. Uses any existing repo in the given directory, or clones one if necessary. Only creates bare clones; Repo does not maintain a checkout.
func (*Repo) TempCheckout ¶
func (r *Repo) TempCheckout(ctx context.Context) (*TempCheckout, error)
TempCheckout returns a TempCheckout of the repo.
type TempCheckout ¶
type TempCheckout Checkout
TempCheckout is a temporary Git Checkout.
func NewTempCheckout ¶
func NewTempCheckout(ctx context.Context, repoUrl string) (*TempCheckout, error)
NewTempCheckout returns a TempCheckout instance.
func (*TempCheckout) Delete ¶
func (c *TempCheckout) Delete()
Delete removes the TempCheckout's working directory.
Directories ¶
Path | Synopsis |
---|---|
gitinfo enables querying info from a Git repository.
|
gitinfo enables querying info from a Git repository. |