Documentation ¶
Index ¶
- Constants
- func RunGitCommand(callback RepoCallback, failureCheck bool, args ...string) string
- type CommitInput
- type CommitOutput
- type FileInput
- type PlaceholderDataReader
- type PointersByOid
- type RefsByName
- type Repo
- func (repo *Repo) AddCommits(inputs []*CommitInput) []*CommitOutput
- func (r *Repo) AddRemote(name string) *Repo
- func (r *Repo) Cleanup()
- func (r *Repo) Configuration() *config.Configuration
- func (r *Repo) Filesystem() *fs.Filesystem
- func (r *Repo) GitConfig() *git.Configuration
- func (r *Repo) GitEnv() config.Environment
- func (r *Repo) OSEnv() config.Environment
- func (r *Repo) Popd()
- func (r *Repo) Pushd()
- type RepoCallback
- type RepoCreateSettings
- type RepoType
- type WorktreesByName
- type WrappedPointersByOid
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func RunGitCommand ¶
func RunGitCommand(callback RepoCallback, failureCheck bool, args ...string) string
Simplistic fire & forget running of git command - returns combined output
Types ¶
type CommitInput ¶
type CommitInput struct { // Date that we should commit on (optional, leave blank for 'now') CommitDate time.Time // List of files to include in this commit Files []*FileInput // List of parent branches (all branches must have been created in a previous NewBranch or be main) // Can be omitted to just use the parent of the previous commit ParentBranches []string // Name of a new branch we should create at this commit (optional - main not required) NewBranch string // Names of any tags we should create at this commit (optional) Tags []string // Name of committer CommitterName string // Email of committer CommitterEmail string }
Input for defining commits for test repo
type CommitOutput ¶
Output struct with details of commits created for test
type FileInput ¶
type FileInput struct { // Name of file (required) Filename string // Size of file (required) Size int64 // Input data (optional, if provided will be source of data) DataReader io.Reader // Input data (optional, if provided will be source of data) Data string }
Input data for a single file in a commit
func (*FileInput) AddToIndex ¶
func (infile *FileInput) AddToIndex(output *CommitOutput, repo *Repo)
type PlaceholderDataReader ¶
type PlaceholderDataReader struct {
// contains filtered or unexported fields
}
Just a pseudo-random stream of bytes (not cryptographic) Calls RNG a bit less often than using rand.Source directly
func NewPlaceholderDataReader ¶
func NewPlaceholderDataReader(seed, size int64) *PlaceholderDataReader
type PointersByOid ¶
PointersByOid implements sort.Interface for []*lfs.Pointer based on oid
func (PointersByOid) Len ¶
func (a PointersByOid) Len() int
func (PointersByOid) Less ¶
func (a PointersByOid) Less(i, j int) bool
func (PointersByOid) Swap ¶
func (a PointersByOid) Swap(i, j int)
type RefsByName ¶
RefsByName implements sort.Interface for []*git.Ref based on name
func (RefsByName) Len ¶
func (a RefsByName) Len() int
func (RefsByName) Less ¶
func (a RefsByName) Less(i, j int) bool
func (RefsByName) Swap ¶
func (a RefsByName) Swap(i, j int)
type Repo ¶
type Repo struct { // Path to the repo, working copy if non-bare Path string // Path to the git dir GitDir string // Paths to remotes Remotes map[string]*Repo // Settings used to create this repo Settings *RepoCreateSettings // contains filtered or unexported fields }
func NewBareRepo ¶ added in v3.6.0
func NewBareRepo(callback RepoCallback) *Repo
NewBareRepo creates a new bare git repo in a new temp dir Note that the repository's path does not end in ".git".
func NewRepo ¶
func NewRepo(callback RepoCallback) *Repo
NewRepo creates a new git repo in a new temp dir
func WrapRepo ¶
func WrapRepo(c RepoCallback, path string) *Repo
WrapRepo creates a new Repo instance for an existing git repo
func (*Repo) AddCommits ¶
func (repo *Repo) AddCommits(inputs []*CommitInput) []*CommitOutput
func (*Repo) Configuration ¶
func (r *Repo) Configuration() *config.Configuration
func (*Repo) Filesystem ¶
func (r *Repo) Filesystem() *fs.Filesystem
func (*Repo) GitConfig ¶
func (r *Repo) GitConfig() *git.Configuration
func (*Repo) GitEnv ¶
func (r *Repo) GitEnv() config.Environment
func (*Repo) OSEnv ¶
func (r *Repo) OSEnv() config.Environment
type RepoCallback ¶
type RepoCallback interface { // Fatalf reports error and fails Fatalf(format string, args ...interface{}) // Errorf reports error and continues Errorf(format string, args ...interface{}) }
Callback interface (testing.T compatible)
type RepoCreateSettings ¶
type RepoCreateSettings struct {
RepoType RepoType
}
type WorktreesByName ¶ added in v3.5.0
WorktreesByName implements sort.Interface for []*git.Worktree based on dir
func (WorktreesByName) Len ¶ added in v3.5.0
func (a WorktreesByName) Len() int
func (WorktreesByName) Less ¶ added in v3.5.0
func (a WorktreesByName) Less(i, j int) bool
func (WorktreesByName) Swap ¶ added in v3.5.0
func (a WorktreesByName) Swap(i, j int)
type WrappedPointersByOid ¶
type WrappedPointersByOid []*lfs.WrappedPointer
WrappedPointersByOid implements sort.Interface for []*lfs.WrappedPointer based on oid
func (WrappedPointersByOid) Len ¶
func (a WrappedPointersByOid) Len() int
func (WrappedPointersByOid) Less ¶
func (a WrappedPointersByOid) Less(i, j int) bool
func (WrappedPointersByOid) Swap ¶
func (a WrappedPointersByOid) Swap(i, j int)