Documentation
¶
Index ¶
- func AheadBehind(repoPath, branch string) (ahead, behind int)
- func DefaultBranch(repoPath string, fallback string) string
- func DiscoverRepos(rootPath string) ([]string, error)
- func FetchRemote(repo *gogit.Repository) error
- func GetBranchName(repo *gogit.Repository) (string, error)
- func GetRepoName(repoPath string) (string, error)
- func GetRepoNameFromRepo(repo *gogit.Repository) (string, error)
- func GetRepoOwnerAndName(repo *gogit.Repository) (string, string, error)
- func IsGitRepository(path string) bool
- func PullChanges(worktree *gogit.Worktree) error
- func PushChanges(repo *gogit.Repository) error
- func SSHAuth() (*ssh.PublicKeys, error)
- type Changes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AheadBehind ¶
AheadBehind uses git rev-list to count commits ahead/behind the remote tracking branch.
func DefaultBranch ¶
DefaultBranch detects the default branch for a repo. Tries origin/HEAD first, then common branch names, then the current branch.
func DiscoverRepos ¶
DiscoverRepos scans one level of subdirectories for git repos.
func FetchRemote ¶
func FetchRemote(repo *gogit.Repository) error
FetchRemote fetches from the origin remote with SSH auth.
func GetBranchName ¶
func GetBranchName(repo *gogit.Repository) (string, error)
GetBranchName returns the current branch name for a repo.
func GetRepoName ¶
GetRepoName returns just the repo name for a path.
func GetRepoNameFromRepo ¶
func GetRepoNameFromRepo(repo *gogit.Repository) (string, error)
GetRepoNameFromRepo extracts the repo name from an already-opened repo.
func GetRepoOwnerAndName ¶
func GetRepoOwnerAndName(repo *gogit.Repository) (string, string, error)
GetRepoOwnerAndName extracts the owner and repo name from origin remote URL.
func IsGitRepository ¶
IsGitRepository checks if a directory contains a .git folder.
func PullChanges ¶
PullChanges pulls changes from the remote using SSH auth.
func PushChanges ¶
func PushChanges(repo *gogit.Repository) error
PushChanges pushes the current branch to the remote using SSH auth.
func SSHAuth ¶
func SSHAuth() (*ssh.PublicKeys, error)
SSHAuth sets up SSH authentication using the private key file specified by the SSH_KEY env var under ~/.ssh/. Result is cached after the first call.
Types ¶
type Changes ¶
Changes holds counts of different change types.
func CountChanges ¶
CountChanges counts changes using go-git's worktree status.
func CountChangesShell ¶
CountChangesShell counts changes using shell git to respect .gitignore.
func (Changes) HasChanges ¶
HasChanges returns true if any changes exist.