Documentation
¶
Overview ¶
Package gitrepo builds a local stand-in for a GitHub repository: a bare remote, a user's clone of it, and a pull request head published at refs/pull/<number>/head.
Index ¶
- func SetProcessEnv() error
- type Repo
- func (r *Repo) AddPull(number int)
- func (r *Repo) BaseSHA() string
- func (r *Repo) Git(args ...string) string
- func (r *Repo) HeadSHA() string
- func (r *Repo) PushBase(files map[string]string) string
- func (r *Repo) PushHead(files map[string]string) string
- func (r *Repo) RemoveHead(paths ...string) string
- func (r *Repo) Snapshot() Snapshot
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetProcessEnv ¶
func SetProcessEnv() error
SetProcessEnv sets New's environment once for the whole process. A TestMain whose tests call t.Parallel MUST call it before m.Run, because New otherwise calls t.Setenv, which panics in a parallel test.
Types ¶
type Repo ¶
type Repo struct {
// Dir is the user's clone.
Dir string
// RemoteDir is the bare repository that origin's URL is rewritten to.
RemoteDir string
// contains filtered or unexported fields
}
func NewWithBase ¶
NewWithBase is New with base also committed in the base, so the pull request can edit those files.
func (*Repo) AddPull ¶
AddPull publishes the current head as another pull request's head, for tests with several pull requests.
func (*Repo) PushBase ¶
PushBase commits files on top of the current base, off the pull request's history, and moves main to it, so the base is no longer the merge base.
func (*Repo) PushHead ¶
PushHead commits files on top of the current pull request head and force-moves the head to it.
func (*Repo) RemoveHead ¶
RemoveHead commits the removal of paths on top of the current pull request head and force-moves the head to it.