gitstatus

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 17 Imported by: 0

Documentation

Overview

Package gitstatus observes status with frozen configuration and explicit repository paths. Git status must never execute repository-owned filters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Executable

func Executable() string

Executable returns the path to spawn for Git. It is the executable `git` names on PATH, except that Apple's xcrun shim is resolved to the Git it would execute, so each spawn runs the same binary without paying the shim again. The result is memoised per PATH and DEVELOPER_DIR value; when `git` cannot be resolved the literal name is returned so the spawn fails as it did before.

func Isolated

func Isolated(ctx context.Context) bool

func ScratchOutside

func ScratchOutside(ctx context.Context, candidate string, roots ...string) error

ScratchOutside refuses an existing, symlink-resolved candidate directory that is, or lies under, any of roots. EvalSymlinks can preserve case and Unicode aliases, so directory identity is compared throughout the bounded ancestry before any private metadata is created.

func Status

func Status(ctx context.Context, root string, limit int, run Runner, arguments ...string) ([]byte, error)

Status runs only against private metadata. All failures are closed: callers must not retry status against the live Git directory.

func StatusIn

func StatusIn(ctx context.Context, root, temporaryParent string, limit int, run Runner, arguments ...string) ([]byte, error)

StatusIn preserves a caller's existing scratch ownership instead of consulting ambient TMPDIR. The parent must remain outside the observed repository.

func WithIsolation

func WithIsolation(ctx context.Context) context.Context

WithIsolation also confines Git's repository discovery at external consumption boundaries. Status always uses private metadata, including standalone calls.

func WithProbeReuse

func WithProbeReuse(ctx context.Context) context.Context

WithProbeReuse lets a status read answer a metadata probe from an earlier successful probe in this process over the same captured bytes (proposed GPK-V0-065; opt-in, never the default). Each probe is a pure function of the private copy: `config --list` of one config file, and `ls-files --stage` plus `rev-parse --shared-index-path` of one index under one config pair, all against the same root and Git directory. Only a success is remembered, so a failure of any kind is asked again, and the status run itself is never reused. The reuse assumes one Git executable for the whole process.

Types

type MetadataProbeError

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

MetadataProbeError identifies failure while Git validates a private metadata copy. Final status execution errors remain unwrapped for caller compatibility.

func (*MetadataProbeError) Error

func (err *MetadataProbeError) Error() string

func (*MetadataProbeError) Unwrap

func (err *MetadataProbeError) Unwrap() error

type Runner

type Runner func(context.Context, string, int, ...string) ([]byte, error)

Jump to

Keyboard shortcuts

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