Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyUpdate ¶
func GetLatestCommitID ¶
func GetLatestCommitID( repoURL string, branch string, creds *Credentials, ) (string, error)
Types ¶
type Credentials ¶
type Credentials struct { // Username identifies a principal, which combined with the value of the // Password field, can be used for accessing some Git repository. Username string // Password, when combined with the principal identified by the Username // field, can be used for accessing some Git repository. Password string // SSHPrivateKey is a private key that can be used for accessing some Git // repository. SSHPrivateKey string }
Credentials represents the credentials for connecting to a private Git repository.
type Repo ¶
type Repo interface { // AddAll stages pending changes for commit. AddAll() error // AddAllAndCommit is a convenience function that stages pending changes for // commit to the current branch and then commits them using the provided // commit message. AddAllAndCommit(message string) error // Clean cleans the working directory. Clean() error // Close cleans up file system resources used by this repository. This should // always be called before a repository goes out of scope. Close() error // Checkout checks out the specified branch. Checkout(branch string) error // Commit commits staged changes to the current branch. Commit(message string) error // CreateChildBranch creates a new branch that is a child of the current // branch. CreateChildBranch(branch string) error // CreateOrphanedBranch creates a new branch that shares no commit history // with any other branch. CreateOrphanedBranch(branch string) error // HasDiffs returns a bool indicating whether the working directory currently // contains any differences from what's already at the head of the current // branch. HasDiffs() (bool, error) // LastCommitID returns the ID (sha) of the most recent commit to the current // branch. LastCommitID() (string, error) // CommitMessage returns the text of the most recent commit message associated // with the specified commit ID. CommitMessage(id string) (string, error) // CommitMessages returns a slice of commit messages starting with id1 and // ending with id2. The results exclude id1, but include id2. CommitMessages(id1, id2 string) ([]string, error) // Push pushes from the current branch to a remote branch by the same name. Push() error // RemoteBranchExists returns a bool indicating if the specified branch exists // in the remote repository. RemoteBranchExists(branch string) (bool, error) // ResetHard performs a hard reset. ResetHard() error // URL returns the remote URL of the repository. URL() string // HomeDir returns an absolute path to the home directory of the system user // who has cloned this repo. HomeDir() string // WorkingDir returns an absolute path to the repository's working tree. WorkingDir() string }
Repo is an interface for interacting with a git repository.
func Clone ¶
func Clone(url string, repoCreds *Credentials) (Repo, error)
Clone produces a local clone of the remote git repository at the specified URL and returns an implementation of the Repo interface that is stateful and NOT suitable for use across multiple goroutines. This function will also perform any setup that is required for successfully authenticating to the remote repository.
Click to show internal directories.
Click to hide internal directories.