git

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package git provides git operations helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkout

func Checkout(ctx context.Context, repoPath, ref string) error

Checkout checks out a specific tag or branch. The ref is validated to prevent unexpected git behavior from malformed references.

func Clone

func Clone(ctx context.Context, url, dest string) error

Clone clones a git repository to the specified destination. Only HTTPS URLs are accepted for security.

func GetCurrentCommit added in v0.2.0

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

GetCurrentCommit returns the current commit hash of the repository

func GetLatestTag

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

GetLatestTag returns the latest tag for a repository in the given path

func InstallSubdir

func InstallSubdir(ctx context.Context, repoURL, branch, subDir, dest string) error

InstallSubdir installs a subdirectory from a repository Uses sparse checkout for efficiency, falls back to full clone if sparse fails

func SparseClone added in v0.2.0

func SparseClone(ctx context.Context, repoURL, branch, subDir, dest string) error

SparseClone clones only a specific subdirectory using sparse checkout. This is much faster than full clone for large repos when only a subdir is needed. Only HTTPS URLs are accepted for security.

Types

This section is empty.

Jump to

Keyboard shortcuts

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