git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHost

func ExtractHost(url string) string

ExtractHost extracts the host from a git URL

func GetBranch

func GetBranch(repoPath string) (string, error)

GetBranch returns the current branch name

func GetBranchWSL

func GetBranchWSL(distro, repoPath string) (string, error)

GetBranchWSL returns the current branch name for a WSL repository

func GetRemoteURL

func GetRemoteURL(repoPath string) (string, error)

GetRemoteURL returns the remote URL for the origin remote

func GetRemoteURLWSL

func GetRemoteURLWSL(distro, repoPath string) (string, error)

GetRemoteURLWSL returns the remote URL for a WSL repository

func IsGitRepo

func IsGitRepo(path string) bool

IsGitRepo checks if a directory is a git repository

func IsGitRepoWSL

func IsGitRepoWSL(distro, path string) bool

IsGitRepoWSL checks if a directory in WSL is a git repository

Types

type CommitInfo

type CommitInfo struct {
	Hash      string
	Author    string
	Timestamp time.Time
}

CommitInfo represents information about a commit

func GetLastCommit

func GetLastCommit(repoPath string) (*CommitInfo, error)

GetLastCommit returns information about the last commit

func GetLastCommitWSL

func GetLastCommitWSL(distro, repoPath string) (*CommitInfo, error)

GetLastCommitWSL returns information about the last commit for a WSL repository

type RemoteStatus

type RemoteStatus struct {
	Ahead  int
	Behind int
}

RemoteStatus represents remote tracking information

func GetRemoteStatus

func GetRemoteStatus(repoPath string) (*RemoteStatus, error)

GetRemoteStatus returns ahead/behind counts compared to upstream

func GetRemoteStatusWSL

func GetRemoteStatusWSL(distro, repoPath string) (*RemoteStatus, error)

GetRemoteStatusWSL returns ahead/behind counts for a WSL repository

type RepoInfo

type RepoInfo struct {
	Branch    string
	Commit    *CommitInfo
	RemoteURL string
	Host      string
}

RepoInfo combines branch, commit, and remote info (fetched in one call)

func GetRepoInfo

func GetRepoInfo(repoPath string) (*RepoInfo, error)

GetRepoInfo gets branch, commit, and remote info in a single efficient call This is much faster than calling GetBranch, GetLastCommit, and GetRemoteURL separately

type Status

type Status struct {
	IsDirty      bool
	HasUntracked bool
}

Status represents the git status of a repository

func GetStatus

func GetStatus(repoPath string) (*Status, error)

GetStatus returns the working tree status

func GetStatusWSL

func GetStatusWSL(distro, repoPath string) (*Status, error)

GetStatusWSL returns the working tree status for a WSL repository

Jump to

Keyboard shortcuts

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