git

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthForURL added in v0.3.0

func GetAuthForURL(remoteURL *url.URL, httpUser, keyFile string) (auth git_transport.AuthMethod, err 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

Types

type TeaRepo added in v0.3.0

type TeaRepo struct {
	*git.Repository
}

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

func RepoForWorkdir added in v0.3.0

func RepoForWorkdir() (*TeaRepo, error)

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

func (TeaRepo) GetOrCreateRemote added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

func (r TeaRepo) TeaCheckout(branchName string) error

TeaCheckout checks out the given branch in the worktree.

func (TeaRepo) TeaCreateBranch added in v0.3.0

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

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

func (TeaRepo) TeaDeleteBranch added in v0.3.0

func (r TeaRepo) TeaDeleteBranch(branch *git_config.Branch, remoteBranch string, auth git_transport.AuthMethod) error

TeaDeleteBranch removes the given branch locally, and if `remoteBranch` is not empty deletes it at it's remote repo.

func (TeaRepo) TeaFindBranchByName added in v0.3.0

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 added in v0.3.0

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) TeaRemoteURL added in v0.3.0

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