gitx

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gitx implements pubgh.RefResolver by invoking the git binary.

New builds a resolver that shells out to `git rev-list -n 1 <tag>` against a checkout. The command resolves the tag to the commit it points at, which is the binding between the release tag and github.sha. The adapter performs no GitHub API calls and never creates, moves, or deletes a tag.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Path is the git executable. An empty path resolves "git" from PATH
	// with [exec.LookPath] when resolving a tag.
	Path string

	// Dir is the child working directory and should be the git checkout.
	// An empty Dir inherits the process working directory.
	Dir string

	// Environ is the child process environment. A nil value inherits
	// [os.Environ]. The slice is used as-is and is never logged.
	Environ []string

	// Stderr receives git diagnostics while the process runs. A nil
	// value discards them. A nonzero exit still captures a bounded tail
	// for the returned error.
	Stderr io.Writer
}

Options configures a Resolver.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver invokes git to resolve a tag to the commit it points at.

It implements pubgh.RefResolver. The resolved commit is what binds a release tag to github.sha. The adapter never creates or mutates tags.

func New

func New(options Options) *Resolver

New constructs a Resolver from options.

Path resolution is deferred until Resolver.Resolve so a missing binary is reported when resolving, not at construction.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, tag rel.Tag) (pubgh.CommitSHA, error)

Resolve implements pubgh.RefResolver.

It runs `git rev-list -n 1 <tag>` as an explicit argument slice through execx.Run, with the configured checkout as the child working directory. That command yields the commit the tag points at, which is the binding between the release tag and github.sha. A nil context, a nil receiver, or an empty tag is rejected before any process starts. A nonzero exit is an unknown-tag error that names the tag. Successful stdout is trimmed and parsed as a pubgh.CommitSHA; any other output is an error that names what was returned. A nonzero exit includes a bounded tail of stderr.

Directories

Path Synopsis
Package mocks contains Mockery-generated doubles for pubgh.RefResolver.
Package mocks contains Mockery-generated doubles for pubgh.RefResolver.

Jump to

Keyboard shortcuts

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