git

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MainBranch = "main"
View Source
const OriginRemote = "origin"

Variables

View Source
var (
	ErrLocalChangesIsPresent = errors.New("local changes are present")
)

Functions

func CreateGitHubPR added in v0.25.2

func CreateGitHubPR(client *github.Client, title string, body string, branchName string, repoName string, organization string, dryRun bool) (*github.PullRequest, error)

func GetRepoName added in v0.26.3

func GetRepoName(localpath string) (string, error)

Types

type AuthMethod

type AuthMethod interface {
	// contains filtered or unexported methods
}

func UrlTokenAuthMethod

func UrlTokenAuthMethod(token string) AuthMethod

type CheckoutOp

type CheckoutOp struct {
	BranchName      string
	CreateIfMissing bool
}

type CloneOp

type CloneOp struct {
	URL        string
	TargetPath string
	Auth       AuthMethod
}

type CommitOp

type CommitOp struct {
	Message    string
	AllowEmpty bool
	DryRun     bool
}

type GithubRepoFullId

type GithubRepoFullId struct {
	RepositoryFullname
	// contains filtered or unexported fields
}

func NewGithubRepoFullId

func NewGithubRepoFullId(repository *github.Repository) GithubRepoFullId

func (GithubRepoFullId) Id

func (i GithubRepoFullId) Id() int

type LocalRepository

type LocalRepository struct {
	DryRun bool
	// contains filtered or unexported fields
}

func CloneToLocalRepository

func CloneToLocalRepository(op CloneOp) (*LocalRepository, error)

func InitLocalRepository

func InitLocalRepository(path string, dryRun bool) (*LocalRepository, error)

func OpenAndResetRepositoryState

func OpenAndResetRepositoryState(path string, dryRun bool) (*LocalRepository, error)

func OpenLocalRepository

func OpenLocalRepository(path string, dryRun bool) (*LocalRepository, error)

func (*LocalRepository) AddAll

func (localRepo *LocalRepository) AddAll() error

func (*LocalRepository) AddFiles

func (localRepo *LocalRepository) AddFiles(paths ...string) error

func (*LocalRepository) CheckoutBranch

func (localRepo *LocalRepository) CheckoutBranch(op *CheckoutOp) error

func (*LocalRepository) Commit

func (localRepo *LocalRepository) Commit(op *CommitOp) error

func (*LocalRepository) CurrentBranch

func (localRepo *LocalRepository) CurrentBranch() (string, error)

func (*LocalRepository) GetRemoteRepoName added in v0.23.0

func (localRepo *LocalRepository) GetRemoteRepoName() (string, error)

func (*LocalRepository) HeadShortCommitHash added in v0.23.0

func (localRepo *LocalRepository) HeadShortCommitHash() (string, error)

HeadShortCommitHash returns short commit hash, currently no support for this feature in go-git lib (some discussions: https://github.com/src-d/go-git/issues/602)

func (*LocalRepository) IsLocalChangesPresent

func (localRepo *LocalRepository) IsLocalChangesPresent() (bool, error)

func (*LocalRepository) Path

func (localRepo *LocalRepository) Path() string

func (*LocalRepository) Pull

func (localRepo *LocalRepository) Pull(auth AuthMethod) (*PullResult, error)

func (*LocalRepository) Push

func (localRepo *LocalRepository) Push(op PushOp) error

func (*LocalRepository) Repository

func (localRepo *LocalRepository) Repository() *git.Repository

func (*LocalRepository) ResetState

func (localRepo *LocalRepository) ResetState() error

func (*LocalRepository) SetRemote

func (localRepo *LocalRepository) SetRemote(url string) error

func (*LocalRepository) Worktree

func (localRepo *LocalRepository) Worktree() *git.Worktree

type PullResult

type PullResult struct {
	IsUpdated bool
}

type PushOp added in v0.25.0

type PushOp struct {
	Auth       AuthMethod
	BranchName string
}

type RepositoryCloneErr added in v0.23.0

type RepositoryCloneErr struct {
	RepositoryErr
}

type RepositoryErr added in v0.23.0

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

func (RepositoryErr) Error added in v0.23.0

func (r RepositoryErr) Error() string

type RepositoryFullname

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

func DeriveRepositoryFullname

func DeriveRepositoryFullname(localRepo *LocalRepository) (RepositoryFullname, error)

func DeriveRepositoryFullnameFromUrl

func DeriveRepositoryFullnameFromUrl(githubRepoUrl string) (RepositoryFullname, error)

func (RepositoryFullname) ActionsHttpUrl

func (n RepositoryFullname) ActionsHttpUrl() string

func (RepositoryFullname) HttpUrl

func (n RepositoryFullname) HttpUrl() string

func (RepositoryFullname) Name

func (n RepositoryFullname) Name() string

func (RepositoryFullname) Organization

func (n RepositoryFullname) Organization() string

func (RepositoryFullname) String

func (n RepositoryFullname) String() string

Jump to

Keyboard shortcuts

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