Documentation
¶
Overview ¶
Package gittest builds throwaway git repositories for tests. Commits are deterministic: fixed author, committer, and timezone, with timestamps advancing one minute per commit.
Index ¶
- type Repo
- func (r *Repo) AnnotatedTag(name, msg string)
- func (r *Repo) Bare() string
- func (r *Repo) Branch(name string)
- func (r *Repo) Checkout(name string)
- func (r *Repo) Commit(msg string) string
- func (r *Repo) Git(args ...string) string
- func (r *Repo) LFSPointer(path string, size int64)
- func (r *Repo) Merge(name string) string
- func (r *Repo) Path() string
- func (r *Repo) Remove(path string)
- func (r *Repo) Rename(from, to string)
- func (r *Repo) SetOrigin(url string)
- func (r *Repo) Submodule(path, sha string)
- func (r *Repo) Symlink(target, path string)
- func (r *Repo) Tag(name string)
- func (r *Repo) Write(path, content string)
- func (r *Repo) WriteBinary(path string, size int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is a scratch repository rooted in a test temp directory.
func (*Repo) AnnotatedTag ¶
AnnotatedTag creates an annotated tag at HEAD.
func (*Repo) Commit ¶
Commit stages everything and commits, returning the commit SHA. The clock advances one minute per commit.
func (*Repo) LFSPointer ¶
LFSPointer writes a git-lfs pointer file at path.
func (*Repo) Submodule ¶
Submodule stages a gitlink entry at path pinned to sha, with no network and no nested repository. The directory is created empty so Commit's add -A sees an uninitialized submodule and keeps the staged entry.
func (*Repo) WriteBinary ¶
WriteBinary writes len bytes including NULs so the file sniffs as binary.