git

package
v0.0.0-...-22766ac Latest Latest
Warning

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

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

Documentation

Overview

Package git provides utilities for detecting git worktree information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitRepo

func IsGitRepo(path string) bool

IsGitRepo returns true if the given path is within a git repository. Returns false on any error (git not installed, not a repo, etc.).

Types

type DetectInfo

type DetectInfo struct {
	GitRoot      string // Worktree root from: git rev-parse --show-toplevel
	GitCommonDir string // Shared .git directory (absolute): git rev-parse --git-common-dir
	IsWorktree   bool   // true if this is a linked worktree (not the main one)
	MainWorktree string // Path to main worktree (parent of GitCommonDir)
	WorktreeID   string // Stable ID: hex(sha256(GitCommonDir))[:12]
}

DetectInfo holds git worktree detection results.

func Detect

func Detect(path string) (*DetectInfo, error)

Detect detects git worktree information for the given path. Returns an error if git is not installed or path is not a git repository.

Jump to

Keyboard shortcuts

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