Documentation
¶
Overview ¶
Package gittest provides shared test doubles for the git package.
Index ¶
- type MockClient
- func (m *MockClient) BisectBad(ctx context.Context) (string, error)
- func (m *MockClient) BisectGood(ctx context.Context) (string, error)
- func (m *MockClient) BisectReset(ctx context.Context) error
- func (m *MockClient) BisectStart(ctx context.Context, bad, good string) error
- func (m *MockClient) Blame(ctx context.Context, path string) ([]git.BlameLine, error)
- func (m *MockClient) BranchCreate(ctx context.Context, name, base string) error
- func (m *MockClient) BranchDelete(ctx context.Context, name string, force bool) error
- func (m *MockClient) BranchList(ctx context.Context) ([]git.Branch, error)
- func (m *MockClient) BranchRename(ctx context.Context, oldName, newName string) error
- func (m *MockClient) Checkout(ctx context.Context, ref string) error
- func (m *MockClient) CherryPick(ctx context.Context, commitHash string) error
- func (m *MockClient) Commit(ctx context.Context, msg string, opts git.CommitOpts) (string, error)
- func (m *MockClient) CurrentBranch(ctx context.Context) (git.Branch, error)
- func (m *MockClient) Diff(ctx context.Context, opts git.DiffOpts) ([]git.FileDiff, error)
- func (m *MockClient) DiffFileNames(ctx context.Context, commitA, commitB string) ([]string, error)
- func (m *MockClient) DiffTreeFiles(ctx context.Context, hash string) ([]string, error)
- func (m *MockClient) DiscardAllUnstaged(ctx context.Context) error
- func (m *MockClient) DiscardFile(ctx context.Context, path string) error
- func (m *MockClient) Fetch(ctx context.Context, opts git.FetchOpts) error
- func (m *MockClient) IsRepo(ctx context.Context) (bool, error)
- func (m *MockClient) Log(ctx context.Context, opts git.LogOpts) ([]git.Commit, error)
- func (m *MockClient) Merge(ctx context.Context, branch string, opts git.MergeOpts) error
- func (m *MockClient) MergeAbort(ctx context.Context) error
- func (m *MockClient) Pull(ctx context.Context, opts git.PullOpts) error
- func (m *MockClient) Push(ctx context.Context, opts git.PushOpts) error
- func (m *MockClient) Rebase(ctx context.Context, onto string, opts git.RebaseOpts) error
- func (m *MockClient) RebaseAbort(ctx context.Context) error
- func (m *MockClient) RebaseContinue(ctx context.Context) error
- func (m *MockClient) Reflog(ctx context.Context, ref string, limit int) ([]git.ReflogEntry, error)
- func (m *MockClient) RemoteAdd(ctx context.Context, name, url string) error
- func (m *MockClient) RemoteList(ctx context.Context) ([]git.Remote, error)
- func (m *MockClient) RemoteRemove(ctx context.Context, name string) error
- func (m *MockClient) RepoRoot(ctx context.Context) (string, error)
- func (m *MockClient) Reset(ctx context.Context, ref string, mode git.ResetMode) error
- func (m *MockClient) Revert(ctx context.Context, hash string) error
- func (m *MockClient) RevertAbort(ctx context.Context) error
- func (m *MockClient) RevertContinue(ctx context.Context) error
- func (m *MockClient) Stage(ctx context.Context, paths []string) error
- func (m *MockClient) StageHunk(ctx context.Context, path string, hunk git.Hunk) error
- func (m *MockClient) StageLine(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error
- func (m *MockClient) StashApply(ctx context.Context, index int) error
- func (m *MockClient) StashDrop(ctx context.Context, index int) error
- func (m *MockClient) StashList(ctx context.Context) ([]git.StashEntry, error)
- func (m *MockClient) StashPop(ctx context.Context, index int) error
- func (m *MockClient) StashPush(ctx context.Context, opts git.StashOpts) error
- func (m *MockClient) StashShow(ctx context.Context, index int) (string, error)
- func (m *MockClient) Status(ctx context.Context) ([]git.FileStatus, error)
- func (m *MockClient) TagCreate(ctx context.Context, name, ref, message string) error
- func (m *MockClient) TagDelete(ctx context.Context, name string) error
- func (m *MockClient) TagList(ctx context.Context) ([]git.Tag, error)
- func (m *MockClient) TagListRemote(ctx context.Context, remote string) ([]git.Tag, error)
- func (m *MockClient) TagPush(ctx context.Context, remote, name string) error
- func (m *MockClient) TagPushAll(ctx context.Context, remote string) error
- func (m *MockClient) Unstage(ctx context.Context, paths []string) error
- func (m *MockClient) UnstageHunk(ctx context.Context, path string, hunk git.Hunk) error
- func (m *MockClient) UnstageLine(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error
- func (m *MockClient) WorktreeAdd(ctx context.Context, path, branch string) error
- func (m *MockClient) WorktreeList(ctx context.Context) ([]git.Worktree, error)
- func (m *MockClient) WorktreeRemove(ctx context.Context, path string, force bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockClient ¶
type MockClient struct {
StatusFunc func(ctx context.Context) ([]git.FileStatus, error)
DiffFunc func(ctx context.Context, opts git.DiffOpts) ([]git.FileDiff, error)
LogFunc func(ctx context.Context, opts git.LogOpts) ([]git.Commit, error)
BlameFunc func(ctx context.Context, path string) ([]git.BlameLine, error)
RepoRootFunc func(ctx context.Context) (string, error)
IsRepoFunc func(ctx context.Context) (bool, error)
DiffTreeFilesFunc func(ctx context.Context, hash string) ([]string, error)
DiffFileNamesFunc func(ctx context.Context, commitA, commitB string) ([]string, error)
StageFunc func(ctx context.Context, paths []string) error
UnstageFunc func(ctx context.Context, paths []string) error
StageHunkFunc func(ctx context.Context, path string, hunk git.Hunk) error
UnstageHunkFunc func(ctx context.Context, path string, hunk git.Hunk) error
StageLineFunc func(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error
UnstageLineFunc func(ctx context.Context, path string, hunk git.Hunk, lineIdx int) error
CommitFunc func(ctx context.Context, msg string, opts git.CommitOpts) (string, error)
BranchListFunc func(ctx context.Context) ([]git.Branch, error)
CurrentBranchFunc func(ctx context.Context) (git.Branch, error)
BranchCreateFunc func(ctx context.Context, name, base string) error
BranchDeleteFunc func(ctx context.Context, name string, force bool) error
BranchRenameFunc func(ctx context.Context, oldName, newName string) error
CheckoutFunc func(ctx context.Context, ref string) error
PushFunc func(ctx context.Context, opts git.PushOpts) error
PullFunc func(ctx context.Context, opts git.PullOpts) error
FetchFunc func(ctx context.Context, opts git.FetchOpts) error
RemoteListFunc func(ctx context.Context) ([]git.Remote, error)
RemoteAddFunc func(ctx context.Context, name, url string) error
RemoteRemoveFunc func(ctx context.Context, name string) error
WorktreeListFunc func(ctx context.Context) ([]git.Worktree, error)
WorktreeAddFunc func(ctx context.Context, path, branch string) error
WorktreeRemoveFunc func(ctx context.Context, path string, force bool) error
StashListFunc func(ctx context.Context) ([]git.StashEntry, error)
StashShowFunc func(ctx context.Context, index int) (string, error)
StashPushFunc func(ctx context.Context, opts git.StashOpts) error
StashPopFunc func(ctx context.Context, index int) error
StashApplyFunc func(ctx context.Context, index int) error
StashDropFunc func(ctx context.Context, index int) error
TagListFunc func(ctx context.Context) ([]git.Tag, error)
TagCreateFunc func(ctx context.Context, name, ref, message string) error
TagDeleteFunc func(ctx context.Context, name string) error
TagListRemoteFunc func(ctx context.Context, remote string) ([]git.Tag, error)
TagPushFunc func(ctx context.Context, remote, name string) error
TagPushAllFunc func(ctx context.Context, remote string) error
MergeFunc func(ctx context.Context, branch string, opts git.MergeOpts) error
MergeAbortFunc func(ctx context.Context) error
RebaseFunc func(ctx context.Context, onto string, opts git.RebaseOpts) error
RebaseContinueFunc func(ctx context.Context) error
RebaseAbortFunc func(ctx context.Context) error
CherryPickFunc func(ctx context.Context, commitHash string) error
BisectStartFunc func(ctx context.Context, bad, good string) error
BisectGoodFunc func(ctx context.Context) (string, error)
BisectBadFunc func(ctx context.Context) (string, error)
BisectResetFunc func(ctx context.Context) error
ReflogFunc func(ctx context.Context, ref string, limit int) ([]git.ReflogEntry, error)
DiscardFileFunc func(ctx context.Context, path string) error
DiscardAllFunc func(ctx context.Context) error
RevertFunc func(ctx context.Context, hash string) error
RevertContinueFunc func(ctx context.Context) error
RevertAbortFunc func(ctx context.Context) error
ResetFunc func(ctx context.Context, ref string, mode git.ResetMode) error
}
MockClient is a test double implementing git.GitClient. Each method has a corresponding exported function field; if non-nil the field is called, otherwise the method returns zero values.
func (*MockClient) BisectGood ¶
func (m *MockClient) BisectGood(ctx context.Context) (string, error)
func (*MockClient) BisectReset ¶
func (m *MockClient) BisectReset(ctx context.Context) error
func (*MockClient) BisectStart ¶
func (m *MockClient) BisectStart(ctx context.Context, bad, good string) error
func (*MockClient) BranchCreate ¶
func (m *MockClient) BranchCreate(ctx context.Context, name, base string) error
func (*MockClient) BranchDelete ¶
func (*MockClient) BranchList ¶
func (*MockClient) BranchRename ¶
func (m *MockClient) BranchRename(ctx context.Context, oldName, newName string) error
func (*MockClient) CherryPick ¶
func (m *MockClient) CherryPick(ctx context.Context, commitHash string) error
func (*MockClient) Commit ¶
func (m *MockClient) Commit(ctx context.Context, msg string, opts git.CommitOpts) (string, error)
func (*MockClient) CurrentBranch ¶
func (*MockClient) DiffFileNames ¶
func (*MockClient) DiffTreeFiles ¶
func (*MockClient) DiscardAllUnstaged ¶
func (m *MockClient) DiscardAllUnstaged(ctx context.Context) error
func (*MockClient) DiscardFile ¶
func (m *MockClient) DiscardFile(ctx context.Context, path string) error
func (*MockClient) MergeAbort ¶
func (m *MockClient) MergeAbort(ctx context.Context) error
func (*MockClient) Rebase ¶
func (m *MockClient) Rebase(ctx context.Context, onto string, opts git.RebaseOpts) error
func (*MockClient) RebaseAbort ¶
func (m *MockClient) RebaseAbort(ctx context.Context) error
func (*MockClient) RebaseContinue ¶
func (m *MockClient) RebaseContinue(ctx context.Context) error
func (*MockClient) Reflog ¶
func (m *MockClient) Reflog(ctx context.Context, ref string, limit int) ([]git.ReflogEntry, error)
func (*MockClient) RemoteAdd ¶
func (m *MockClient) RemoteAdd(ctx context.Context, name, url string) error
func (*MockClient) RemoteList ¶
func (*MockClient) RemoteRemove ¶
func (m *MockClient) RemoteRemove(ctx context.Context, name string) error
func (*MockClient) RevertAbort ¶
func (m *MockClient) RevertAbort(ctx context.Context) error
func (*MockClient) RevertContinue ¶
func (m *MockClient) RevertContinue(ctx context.Context) error
func (*MockClient) StashApply ¶
func (m *MockClient) StashApply(ctx context.Context, index int) error
func (*MockClient) StashList ¶
func (m *MockClient) StashList(ctx context.Context) ([]git.StashEntry, error)
func (*MockClient) Status ¶
func (m *MockClient) Status(ctx context.Context) ([]git.FileStatus, error)
func (*MockClient) TagCreate ¶
func (m *MockClient) TagCreate(ctx context.Context, name, ref, message string) error
func (*MockClient) TagDelete ¶
func (m *MockClient) TagDelete(ctx context.Context, name string) error
func (*MockClient) TagListRemote ¶
func (*MockClient) TagPush ¶
func (m *MockClient) TagPush(ctx context.Context, remote, name string) error
func (*MockClient) TagPushAll ¶
func (m *MockClient) TagPushAll(ctx context.Context, remote string) error
func (*MockClient) Unstage ¶
func (m *MockClient) Unstage(ctx context.Context, paths []string) error
func (*MockClient) UnstageHunk ¶
func (*MockClient) UnstageLine ¶
func (*MockClient) WorktreeAdd ¶
func (m *MockClient) WorktreeAdd(ctx context.Context, path, branch string) error
func (*MockClient) WorktreeList ¶
func (*MockClient) WorktreeRemove ¶
Click to show internal directories.
Click to hide internal directories.