Documentation
¶
Index ¶
Constants ¶
const ( DefaultRemote = "origin" DefaultBranch = "master" DefaultPublicKeyAuthUser = "git" )
Variables ¶
var ( ErrNoGitRepository = errors.New("no git repository") ErrNoStagedFiles = errors.New("no staged files") )
var HostKeyAlgos []string
HostKeyAlgos holds the HostKey algorithms that the SSH client will advertise to the server. If empty, Go's default is used instead.
var KexAlgos []string
KexAlgos hosts the key exchange algorithms to be used for SSH connections. If empty, Go's default is used instead.
Functions ¶
func IsConcreteCommit ¶ added in v0.5.0
IsConcreteCommit returns if a given commit is a concrete commit. Concrete commits have most of commit metadata and commit content. In contrast, a partial commit may only have some metadata and no commit content.
func SecurePath ¶ added in v0.6.0
SecurePath accepts an absolute or relative path and returns a path that is safe for use. If the path is absolute, it's `filepath.Clean`ed and returned. If the path is relative, it's securely joined against the working directory to ensure that the resultant path is a child of the working directory.
Types ¶
type AuthOptions ¶ added in v0.5.0
type AuthOptions struct {
Transport TransportType
Host string
Username string
Password string
BearerToken string
Identity []byte
KnownHosts []byte
CAFile []byte
}
AuthOptions are the authentication options for the Transport of communication with a remote origin.
func NewAuthOptions ¶ added in v0.5.0
NewAuthOptions constructs an AuthOptions object from the given map and URL. If the map is empty, it returns a minimal AuthOptions object after validating the result.
func (AuthOptions) Validate ¶ added in v0.5.0
func (o AuthOptions) Validate() error
Validate the AuthOptions against the defined Transport.
type Commit ¶ added in v0.5.0
type Commit struct {
// Hash is the SHA1 hash of the commit.
Hash Hash
// Reference is the original reference of the commit, for example:
// 'refs/tags/foo'.
Reference string
// Author is the original author of the commit.
Author Signature
// Committer is the one performing the commit, might be different from
// Author.
Committer Signature
// Signature is the PGP signature of the commit.
Signature string
// Encoded is the encoded commit, without any signature.
Encoded []byte
// Message is the commit message, contains arbitrary text.
Message string
}
Commit contains all possible information about a Git commit.
func (*Commit) ShortMessage ¶ added in v0.5.0
ShortMessage returns the first 50 characters of a commit subject.
type ErrRepositoryNotFound ¶ added in v0.5.0
ErrRepositoryNotFound indicates that the repository (or the ref in question) does not exist at the given URL.
func (ErrRepositoryNotFound) Error ¶ added in v0.5.0
func (e ErrRepositoryNotFound) Error() string
type Signature ¶ added in v0.5.0
Signature represents an entity which associates a person and a time with a commit.
type TransportType ¶ added in v0.5.0
type TransportType string
const ( SSH TransportType = "ssh" HTTPS TransportType = "https" HTTP TransportType = "http" )