git

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package git defines the GitRunner interface and a system-git implementation that shells out to the installed git binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner interface {
	// LsRemoteTags lists the repo's tags and the commits they point to.
	LsRemoteTags(ctx context.Context, url string) ([]TagRef, error)
	// ResolveRef resolves a branch, tag, or commit ref to an immutable commit SHA.
	ResolveRef(ctx context.Context, url, ref string) (string, error)
	// FetchCommit materializes the tree at commit into dest, without a .git dir.
	FetchCommit(ctx context.Context, url, commit, dest string) error
}

Runner is the git capability gskill needs. The system implementation shells out to the git binary; the interface lets it be swapped (e.g. go-git) later.

type SystemRunner

type SystemRunner struct{}

SystemRunner implements Runner by shelling out to the system git binary.

func NewSystemRunner

func NewSystemRunner() SystemRunner

NewSystemRunner returns a Runner backed by the system git binary.

func (SystemRunner) FetchCommit

func (SystemRunner) FetchCommit(ctx context.Context, url, commit, dest string) error

FetchCommit materializes the tree at commit into dest with no .git directory.

func (SystemRunner) LsRemoteTags

func (SystemRunner) LsRemoteTags(ctx context.Context, url string) ([]TagRef, error)

LsRemoteTags lists tags via "git ls-remote --tags", preferring the peeled (^{}) commit for annotated tags.

func (SystemRunner) ResolveRef

func (SystemRunner) ResolveRef(ctx context.Context, url, ref string) (string, error)

ResolveRef resolves a ref to an immutable commit SHA. A full SHA is returned as-is; otherwise the ref is looked up via "git ls-remote".

type TagRef

type TagRef struct {
	Name   string
	Commit string
}

TagRef pairs a tag name with the commit it resolves to.

Jump to

Keyboard shortcuts

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