Documentation
¶
Overview ¶
Package git provides Git operations for gitcode-cli
Index ¶
- func Clone(repo *Repo, dir string, depth int) error
- func CloneWithProtocol(repo *Repo, dir string, protocol string, depth int) error
- func CurrentBranch() (string, error)
- func DefaultRemote() (string, error)
- func HasLocalChanges() (bool, error)
- func IsRepo() bool
- func RemoteURL(name string) (string, error)
- func Remotes() ([]string, error)
- func RootDir() (string, error)
- func Run(args ...string) (string, error)
- func RunInDir(dir string, args ...string) (string, error)
- func RunInDirWithEnv(dir string, env map[string]string, args ...string) (string, error)
- func RunWithEnv(env map[string]string, args ...string) (string, error)
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
Clone clones a repository to the specified directory
func CloneWithProtocol ¶
CloneWithProtocol clones a repository using the specified protocol
func CurrentBranch ¶
CurrentBranch returns the current branch name
func DefaultRemote ¶
DefaultRemote returns the default remote (origin or first available)
func HasLocalChanges ¶
HasLocalChanges returns true if there are uncommitted changes
func RootDir ¶
RootDir returns the root directory of the git repository
func Run ¶
Run executes a git command and returns the output
func RunInDir ¶
RunInDir executes a git command in a specific directory
func RunInDirWithEnv ¶ added in v0.3.9
RunInDirWithEnv executes a git command in a specific directory with extra environment variables.
Types ¶
type Repo ¶
Repo represents a parsed repository reference
func CurrentRepo ¶
CurrentRepo returns the current repository from git remote
func ParseRepo ¶
ParseRepo parses a repository reference Supports formats: - owner/repo - https://gitcode.com/owner/repo - git@gitcode.com:owner/repo.git
func (*Repo) GitURL ¶
GitURL returns the git URL for the repository
func (*Repo) String ¶
String returns the full repository path (owner/name)
Source Files
¶
- git.go
- repo.go