git

package
v1.193.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalRepo

func GetLocalRepo() (*git.Repository, error)

func GetRepoConfig

func GetRepoConfig(repo *git.Repository) (*config.Config, error)

func OpenWorktreeAwareRepo added in v1.191.0

func OpenWorktreeAwareRepo(path string) (*git.Repository, error)

OpenWorktreeAwareRepo opens a Git repository at the given path, handling both regular repositories and worktrees correctly. It uses EnableDotGitCommonDir to properly support worktrees with access to the main repository's config, remotes, and references.

Types

type DefaultGitRepo added in v1.192.0

type DefaultGitRepo struct{}

DefaultGitRepo is the default implementation of GitRepoInterface.

func (*DefaultGitRepo) GetCurrentCommitSHA added in v1.192.0

func (d *DefaultGitRepo) GetCurrentCommitSHA() (string, error)

GetCurrentCommitSHA returns the SHA of the current HEAD commit.

func (*DefaultGitRepo) GetLocalRepoInfo added in v1.192.0

func (d *DefaultGitRepo) GetLocalRepoInfo() (*RepoInfo, error)

GetLocalRepoInfo returns information about the local git repository.

func (*DefaultGitRepo) GetRepoInfo added in v1.192.0

func (d *DefaultGitRepo) GetRepoInfo(repo *git.Repository) (RepoInfo, error)

GetRepoInfo returns the repository information for the given git.Repository.

type GitRepoInterface added in v1.192.0

type GitRepoInterface interface {
	GetLocalRepoInfo() (*RepoInfo, error)
	GetRepoInfo(repo *git.Repository) (RepoInfo, error)
	GetCurrentCommitSHA() (string, error)
}

GitRepoInterface defines the interface for git repository operations.

func NewDefaultGitRepo added in v1.192.0

func NewDefaultGitRepo() GitRepoInterface

NewDefaultGitRepo creates a new instance of DefaultGitRepo.

type RepoInfo

type RepoInfo struct {
	LocalRepoPath     string
	LocalWorktree     *git.Worktree
	LocalWorktreePath string
	RepoUrl           string
	RepoOwner         string
	RepoName          string
	RepoHost          string
}

func GetRepoInfo

func GetRepoInfo(localRepo *git.Repository) (RepoInfo, error)

Jump to

Keyboard shortcuts

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