Documentation
¶
Overview ¶
Package gitutil — centralized date display formatting.
Package gitutil extracts Git metadata by running git commands.
Package gitutil — latest-branch core operations.
Package gitutil — latest-branch resolve operations.
Index ¶
- func CheckOnline() error
- func CurrentBranch(repoPath string) (string, error)
- func FetchAll(repoPath string)
- func FetchAllPrune() error
- func FilterByPattern(refs []string, pattern string) []string
- func FilterByRemote(refs []string, remote string) []string
- func FormatDisplayDate(t time.Time) string
- func FormatDisplayDateUTC(t time.Time) string
- func IsInsideWorkTree() bool
- func IsOnline() bool
- func ListRemoteBranches() ([]string, error)
- func PrintOfflineWarning()
- func RemoteURL(repoPath string) (string, error)
- func ResolveContains(sha, remote string) []string
- func ResolvePointsAt(sha, remote string) []string
- func SortByDateDesc(items []RemoteBranchInfo)
- func SortByNameAsc(items []RemoteBranchInfo)
- func StripRemotePrefix(ref string) string
- func TruncSha(sha string) string
- type RemoteBranchInfo
- type RepoStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOnline ¶
func CheckOnline() error
CheckOnline verifies network connectivity by dialing a remote host.
func CurrentBranch ¶
CurrentBranch returns the current branch name for a repo.
func FetchAll ¶
func FetchAll(repoPath string)
FetchAll runs git fetch --all --prune for a repo (best effort).
func FilterByPattern ¶
FilterByPattern keeps only refs whose branch name matches the given glob or substring pattern.
func FilterByRemote ¶
FilterByRemote keeps only refs starting with "<remote>/".
func FormatDisplayDate ¶
FormatDisplayDate converts a time.Time to the local time zone and returns a human-friendly string: DD-Mon-YYYY hh:mm AM/PM.
func FormatDisplayDateUTC ¶
FormatDisplayDateUTC converts a time.Time to UTC and returns a human-friendly string: DD-Mon-YYYY hh:mm AM/PM (UTC).
func IsInsideWorkTree ¶
func IsInsideWorkTree() bool
IsInsideWorkTree checks if the current directory is inside a git repo.
func ListRemoteBranches ¶
ListRemoteBranches returns trimmed remote-tracking branch names, excluding HEAD pointer lines.
func PrintOfflineWarning ¶
func PrintOfflineWarning()
PrintOfflineWarning prints a user-friendly offline message.
func ResolveContains ¶
ResolveContains returns branch names whose history contains sha.
func ResolvePointsAt ¶
ResolvePointsAt returns branch names that point exactly at sha.
func SortByDateDesc ¶
func SortByDateDesc(items []RemoteBranchInfo)
SortByDateDesc sorts items by CommitDate descending.
func SortByNameAsc ¶
func SortByNameAsc(items []RemoteBranchInfo)
SortByNameAsc sorts items by branch name ascending.
func StripRemotePrefix ¶
StripRemotePrefix removes the "<remote>/" prefix from a ref.
Types ¶
type RemoteBranchInfo ¶
RemoteBranchInfo holds commit metadata for a remote-tracking branch.
func ReadBranchTips ¶
func ReadBranchTips(refs []string) ([]RemoteBranchInfo, error)
ReadBranchTips reads commit metadata for each remote ref.
type RepoStatus ¶
type RepoStatus struct {
Branch string
Dirty bool
Untracked int
Modified int
Staged int
Ahead int
Behind int
StashCount int
Unreachable bool
}
RepoStatus holds the live state of a Git repository.
func Status ¶
func Status(repoPath string) RepoStatus
Status returns the full live status of a repository. If the path does not exist or is not a git repo, Unreachable is set.