gitutil

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentBranch

func GetCurrentBranch(ctx context.Context, repoPath string) (string, error)

GetCurrentBranch returns the current branch name

func GetCurrentCommit

func GetCurrentCommit(ctx context.Context, repoPath string) (string, error)

GetCurrentCommit returns the current commit SHA

func GetRemoteURL

func GetRemoteURL(ctx context.Context, repoPath string) (string, error)

GetRemoteURL returns the remote URL for the repository (typically 'origin')

func GetRepoRoot

func GetRepoRoot(ctx context.Context, path string) (string, error)

GetRepoRoot returns the root directory of the Git repository

func HasUncommittedChanges

func HasUncommittedChanges(ctx context.Context, repoPath string) (bool, error)

HasUncommittedChanges checks if there are uncommitted changes in the repository

func IsGitRepo

func IsGitRepo(path string) bool

IsGitRepo checks if the given path is inside a Git repository

Types

type GitContext

type GitContext struct {
	IsRepo       bool   // True if current directory is in a Git repository
	RepoRoot     string // Absolute path to repository root
	RepoURL      string // Remote repository URL
	RelativePath string // Current path relative to repo root
}

GitContext represents the current Git repository context

func DetectContext

func DetectContext(ctx context.Context) (*GitContext, error)

DetectContext detects the Git context for the current working directory

func DetectContextForPath

func DetectContextForPath(ctx context.Context, path string) (*GitContext, error)

DetectContextForPath detects the Git context for a specific path

Jump to

Keyboard shortcuts

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