Version: v0.7.1-0...-009166e Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 10 Imported by: 0




This section is empty.


This section is empty.


func GetAuthForURL

func GetAuthForURL(remoteURL *url.URL, authToken, keyFile string, passwordCallback pwCallback) (git_transport.AuthMethod, error)

GetAuthForURL returns the appropriate AuthMethod to be used in Push() / Pull() operations depending on the protocol, and prompts the user for credentials if necessary.

func ParseURL

func ParseURL(rawURL string) (u *url.URL, err error)

ParseURL parses URL string and return URL struct


type TeaRepo

type TeaRepo struct {

TeaRepo is a go-git Repository, with an extended high level interface.

func RepoForWorkdir

func RepoForWorkdir() (*TeaRepo, error)

RepoForWorkdir tries to open the git repository in the local directory for reading or modification.

func RepoFromPath

func RepoFromPath(path string) (*TeaRepo, error)

RepoFromPath tries to open the git repository by path

func (TeaRepo) GetOrCreateRemote

func (r TeaRepo) GetOrCreateRemote(remoteURL, newRemoteName string) (*git.Remote, error)

GetOrCreateRemote tries to match a Remote of the repo via the given URL. If no match is found, a new Remote with `newRemoteName` is created. Matching is based on the normalized URL, accepting different protocols.

func (TeaRepo) GetRemote

func (r TeaRepo) GetRemote(remoteURL string) (*git.Remote, error)

GetRemote tries to match a Remote of the repo via the given URL. Matching is based on the normalized URL, accepting different protocols.

func (TeaRepo) TeaCheckout

func (r TeaRepo) TeaCheckout(ref git_plumbing.ReferenceName) error

TeaCheckout checks out the given branch in the worktree.

func (TeaRepo) TeaCreateBranch

func (r TeaRepo) TeaCreateBranch(localBranchName, remoteBranchName, remoteName string) error

TeaCreateBranch creates a new branch in the repo, tracking from another branch.

func (TeaRepo) TeaDeleteLocalBranch

func (r TeaRepo) TeaDeleteLocalBranch(branch *git_config.Branch) error

TeaDeleteLocalBranch removes the given branch locally

func (TeaRepo) TeaDeleteRemoteBranch

func (r TeaRepo) TeaDeleteRemoteBranch(remoteName, remoteBranch string, auth git_transport.AuthMethod) error

TeaDeleteRemoteBranch removes the given branch on the given remote via git protocol

func (TeaRepo) TeaFindBranchByName

func (r TeaRepo) TeaFindBranchByName(branchName, repoURL string) (b *git_config.Branch, err error)

TeaFindBranchByName returns a branch that is at the the given local and remote names and syncs to the given remote repo. This method is less precise than TeaFindBranchBySha(), but may be desirable if local and remote branch have diverged.

func (TeaRepo) TeaFindBranchBySha

func (r TeaRepo) TeaFindBranchBySha(sha, repoURL string) (b *git_config.Branch, err error)

TeaFindBranchBySha returns a branch that is at the the given SHA and syncs to the given remote repo.

func (TeaRepo) TeaFindBranchRemote

func (r TeaRepo) TeaFindBranchRemote(branchName, hash string) (*git.Remote, error)

TeaFindBranchRemote gives the first remote that has a branch with the same name or sha, depending on what is passed in. This function is needed, as git does not always define branches in .git/config with remote entries.

func (TeaRepo) TeaGetCurrentBranchName

func (r TeaRepo) TeaGetCurrentBranchName() (string, error)

TeaGetCurrentBranchName return the name of the branch witch is currently active

func (TeaRepo) TeaRemoteURL

func (r TeaRepo) TeaRemoteURL(name string) (auth *url.URL, err error)

TeaRemoteURL returns the first url entry for the given remote name

type URLParser

type URLParser struct {

URLParser represents a git URL parser

func (*URLParser) Parse

func (p *URLParser) Parse(rawURL string) (u *url.URL, err error)

Parse parses the git URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL