Documentation ¶
Index ¶
Constants ¶
const NilHash = Hash("")
NilHash is the zero value, i.e. the absence of a Hash.
Variables ¶
var ( // ErrRepoExists means that the given directory already has a git repository // in it, and a new repository can't be created there. ErrRepoExists = errors.New("Repo already exists") )
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git interface { NewRepository(dst string) (WriteableRepository, error) OpenRepository(repoDir string) (Repository, error) GetRelativeLocation(currentDir string) (string, error) }
Git is an interface to a subset of Git functionality.
type Repository ¶
type Repository interface { RootDir() string ResolveCommit(ref string) (ResolvedUserRef, error) }
Repository represents a git repository somewhere on disk. It's not able to perform destructive actions -- for that, you need to obtain a WriteableRepository or a WorkingRepository.
type ResolvedCommit ¶
type ResolvedCommit interface { Repo() Repository Hash() Hash }
ResolvedCommit represents a commit which definitely exists within its associated repository.
type ResolvedUserRef ¶
type ResolvedUserRef interface { Commit() ResolvedCommit UserRef() string }
ResolvedUserRef represents a user-provided commit-ish, which has then been resolved to a commit in the git repo. This is useful info together for referring back to input that the user has supplied; notably, the String() method returns a representation of the user's input and the SHA together.
type WorktreeRepository ¶
type WorktreeRepository interface { Repository Remove() error Checkout(commit ResolvedCommit) error }
WorktreeRepository represents a temporary scratch git repository where it's ok to checkout files, and delete the repository later, but not to commit things.
type WriteableRepository ¶
type WriteableRepository interface { // WriteableRepository is intentionally not a superset of WorktreeRepository // so we don't have to be aware of Checkouts etc in the Commit / Clear // methods. Repository CommitEverythingInWorktree(message string) (Hash, error) ClearSourceControlledFilesFromWorktree() error }
WriteableRepository is a Repository that allows commits / edits to the git history.