{"modulePath":"github.com/lerenn/code-manager","version":"v0.31.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\nPackage git provides Git operations and error definitions.\n\n## Variables\n\n```go\nvar (\n\tErrBranchNotFound         = errors.New(\"branch not found\")\n\tErrWorktreeExists         = errors.New(\"worktree already exists\")\n\tErrWorktreeNotFound       = errors.New(\"worktree not found\")\n\tErrWorktreePathNotFound   = errors.New(\"worktree path not found\")\n\tErrRepositoryNotClean     = errors.New(\"repository is not clean\")\n\tErrRemoteAddFailed        = errors.New(\"failed to add remote\")\n\tErrFetchFailed            = errors.New(\"failed to fetch from remote\")\n\tErrBranchNotFoundOnRemote = errors.New(\"branch not found on remote\")\n\n\t// Specific reference conflict error types for testing.\n\tErrBranchParentExists = errors.New(\"cannot create branch: reference already exists\")\n\tErrTagParentExists    = errors.New(\"cannot create branch: tag already exists\")\n)\n```\nGit-specific error types.\n\n## Functions\n\n```go\nfunc SetupTestRepo(t *testing.T) (string, func())\n```\nSetupTestRepo creates a temporary git repository for testing.\n\n## Types\n\n```go\ntype BranchExistsOnRemoteParams struct {\n\tRepoPath   string\n\tRemoteName string\n\tBranch     string\n}\n```\nBranchExistsOnRemoteParams contains parameters for BranchExistsOnRemote.\n\n```go\ntype CloneParams struct {\n\tRepoURL    string\n\tTargetPath string\n\tRecursive  bool\n}\n```\nCloneParams contains parameters for Clone.\n\n```go\ntype CreateBranchFromParams struct {\n\tRepoPath   string\n\tNewBranch  string\n\tFromBranch string\n}\n```\nCreateBranchFromParams contains parameters for CreateBranchFrom.\n\n```go\ntype Git interface {\n\t// Status executes `git status` in specified directory.\n\tStatus(workDir string) (string, error)\n\n\t// ConfigGet executes `git config --get \u003ckey\u003e` in specified directory.\n\tConfigGet(workDir, key string) (string, error)\n\n\t// CreateWorktree creates a new worktree for the specified branch.\n\tCreateWorktree(repoPath, worktreePath, branch string) error\n\n\t// CreateWorktreeWithNoCheckout creates a new worktree without checking out files.\n\tCreateWorktreeWithNoCheckout(repoPath, worktreePath, branch string) error\n\n\t// CloneToPath clones a local repository to a target path with a specific branch.\n\tCloneToPath(sourceRepoPath, targetPath, branch string) error\n\n\t// CheckoutBranch checks out a branch in the specified worktree.\n\tCheckoutBranch(worktreePath, branch string) error\n\n\t// GetCurrentBranch gets the current branch name.\n\tGetCurrentBranch(repoPath string) (string, error)\n\n\t// GetRepositoryName gets the repository name from remote origin URL with fallback to local path.\n\tGetRepositoryName(repoPath string) (string, error)\n\n\t// IsClean checks if the repository is in a clean state (placeholder for future validation).\n\tIsClean(repoPath string) (bool, error)\n\n\t// BranchExists checks if a branch exists locally or remotely.\n\tBranchExists(repoPath, branch string) (bool, error)\n\n\t// CreateBranchFrom creates a new branch from a specific branch.\n\tCreateBranchFrom(params CreateBranchFromParams) error\n\n\t// CheckReferenceConflict checks if creating a branch would conflict with existing references.\n\tCheckReferenceConflict(repoPath, branch string) error\n\n\t// WorktreeExists checks if a worktree exists for the specified branch.\n\tWorktreeExists(repoPath, branch string) (bool, error)\n\n\t// RemoveWorktree removes a worktree from Git's tracking.\n\tRemoveWorktree(repoPath, worktreePath string, force bool) error\n\n\t// GetWorktreePath gets the path of a worktree for a branch.\n\tGetWorktreePath(repoPath, branch string) (string, error)\n\n\t// AddRemote adds a new remote to the repository.\n\tAddRemote(repoPath, remoteName, remoteURL string) error\n\n\t// FetchRemote fetches from a specific remote.\n\tFetchRemote(repoPath, remoteName string) error\n\n\t// BranchExistsOnRemote checks if a branch exists on a specific remote.\n\tBranchExistsOnRemote(params BranchExistsOnRemoteParams) (bool, error)\n\n\t// GetRemoteURL gets the URL of a remote.\n\tGetRemoteURL(repoPath, remoteName string) (string, error)\n\n\t// RemoteExists checks if a remote exists.\n\tRemoteExists(repoPath, remoteName string) (bool, error)\n\n\t// Clone clones a repository to the specified path.\n\tClone(params CloneParams) error\n\n\t// GetDefaultBranch gets the default branch name from a remote repository.\n\tGetDefaultBranch(remoteURL string) (string, error)\n\n\t// Add adds files to the Git staging area.\n\tAdd(repoPath string, files ...string) error\n\n\t// CreateBranch creates a new branch from the current branch.\n\tCreateBranch(repoPath, branch string) error\n\n\t// Commit creates a new commit with the specified message.\n\tCommit(repoPath, message string) error\n\n\t// GetBranchRemote gets the remote name for a branch (e.g., \"origin\", \"justenstall\").\n\tGetBranchRemote(repoPath, branch string) (string, error)\n\n\t// SetUpstreamBranch sets the upstream branch for the current branch.\n\tSetUpstreamBranch(repoPath, remote, branch string) error\n\n\t// GetMainRepositoryPath gets the main repository path from a worktree path.\n\t// If the path is already a main repository, it returns the same path.\n\t// If the path is a worktree, it returns the main repository path.\n\tGetMainRepositoryPath(worktreePath string) (string, error)\n}\n```\nGit interface provides Git command execution capabilities.\n\n```go\nfunc NewGit() Git\n```\nNewGit creates a new Git instance.\n\n","path":"github.com/lerenn/code-manager/pkg/git","name":"git","synopsis":"Package git provides Git operations and error definitions.","isRedistributable":true}
