git

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: BSD-3-Clause Imports: 24 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSSHToHTTPS added in v1.1.9

func ConvertSSHToHTTPS(url string) string

convertSSHToHTTPS converts SSH URLs to HTTPS URLs for public access

func Info

func Info(args ...interface{})

Info uses pterm to display info messages. * * format: The format to use. * args: The arguments to use.

Types

type Option

type Option func(c *Repository) error

func Author

func Author(username, email string) Option

Author is an Option to set the repository author. * * username: The username to use. * email: The email to use.

func Branch

func Branch(branch string) Option

Branch is an Option to set the repository branch. * * branch: The branch to use.

func EmbeddedToken

func EmbeddedToken(token string) Option

EmbeddedToken is an Option to set the repository token. * the token will also be embedded in the remote url. * * token: The token to use.

func Output added in v1.1.9

func Output(output io.Writer) Option

Output is an Option to set the repository output. * * output: The output to use.

func Preserve

func Preserve() Option

Preserve is an Option to set the repository to be preserved. * For use with Temporary to keep the tmp/repo-* directory alive * * Returns error if something goes wrong.

func Root

func Root(root string) Option

Root is an Option to set the repository root. * * root: The root to use.

func SSHKey

func SSHKey(key string) Option

SSHKey is an Option to set the repository SSH key. * * key: The key to use.

func Temporary

func Temporary() Option

Temporary is an Option to set the repository to be temporary. * * Returns error if something goes wrong.

func Token

func Token(token string) Option

Token is an Option to set the repository token. * * token: The token to use.

func URL

func URL(url string) Option

URL is an Option to set the repository URL. * * url: The URL to use.

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository represents a repository. * * ctx: The context to use. * repo: The repository. * workdir: The working directory. * i_cloned_it: If I cloned the repository. * url: The url to the repository. * auth: The authentication to use. * root: The root of the repository. * ephemeral: If the repository is ephemeral. * ephemeralNoDelete: If the ephemeral repository should not be deleted. * user: The user to use. * branches: The branches to use. * usingSpecifcBranch: If a specific branch is used.

func New

func New(ctx context.Context, options ...Option) (c *Repository, err error)

New creates a new repository.

  • ctx: The context to use.
  • options: The options to use. *
  • Returns the repository and error if something goes wrong.

func (*Repository) Checkout

func (c *Repository) Checkout(branchName string) error

func (*Repository) Commit

func (c *Repository) Commit(message string, files string) error

Commit commits the changes to the repository. * * message: The message to be used for the commit. * files: The files to be committed. * * Returns error if something goes wrong.

func (*Repository) Dir

func (c *Repository) Dir() string

Dir returns the directory of the repository.

func (*Repository) Fetch

func (c *Repository) Fetch() error

Fetch fetches the changes from the repository. * * Returns error if something goes wrong.

func (*Repository) ListBranches

func (r *Repository) ListBranches(fetch bool) (branches []string, fetchErr error, err error)

ListBranches will return a list of branches for the repository

fetch true will search remote origin to gather all branches fetch false will search .git/config to gather branches

func (*Repository) Pull

func (c *Repository) Pull() error

Pull pulls the changes from the repository. * * Returns error if something goes wrong.

func (*Repository) Push

func (c *Repository) Push() error

Push pushes the changes to the repository. * * Returns error if something goes wrong.

func (*Repository) Repo

func (c *Repository) Repo() *git.Repository

func (*Repository) Root

func (c *Repository) Root() string

Root returns the root directory of the repository.

Jump to

Keyboard shortcuts

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