gitx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gitx shells out to the installed git binary (§6: any Git URL syntax git supports is accepted): worktree discovery, remote ref resolution, and a bare-repository cache of scaffold sources (§50). The cache location is $GIT_SCAFFOLD_CACHE, else the global config cache-dir, else $XDG_CACHE_HOME/git-scaffold, else ~/.cache/git-scaffold (§56), keyed by a hash of the source URL. The cache never affects output determinism: it only stores immutable Git objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Git

func Git(dir string, stdin []byte, extraEnv []string, args ...string) (string, error)

Git runs an arbitrary git command in dir with optional stdin content and extra environment entries, returning trimmed stdout. It exists for callers (the proposal flow, §39-§45) that drive git plumbing in the target repository rather than the source cache.

func WorktreeRoot

func WorktreeRoot(dir string) (string, error)

WorktreeRoot resolves the root of the Git worktree containing dir (§49: commands may run from subdirectories).

Types

type Source

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

Source is a scaffold source repository backed by a bare cache repository.

func Open

func Open(url string) (*Source, error)

Open ensures the bare cache repository for url exists and returns it. No network access occurs.

func (*Source) EnsureCommit

func (s *Source) EnsureCommit(sha string) error

EnsureCommit makes sha available in the cache, fetching only if it is missing (§50: a locally available locked commit needs no network).

func (*Source) Fetch

func (s *Source) Fetch() error

Fetch updates the cache with all heads and tags of the source.

func (*Source) HasCommit

func (s *Source) HasCommit(sha string) bool

HasCommit reports whether sha resolves to a commit already in the cache.

func (*Source) ReadTree

func (s *Source) ReadTree(sha string) (map[string][]byte, error)

ReadTree loads the full tree of a commit into memory as repository-relative `/`-separated paths. Only regular-file blobs are included (§9: symlinks and submodules are never materialized).

func (*Source) ResolveRef

func (s *Source) ResolveRef(ref string) (string, error)

ResolveRef resolves ref against the remote (ls-remote); an empty ref means the remote's HEAD (§6). Refs not advertised remotely (e.g. commit SHAs) fall back to local resolution after a fetch.

func (*Source) URL

func (s *Source) URL() string

URL returns the configured source URL.

Jump to

Keyboard shortcuts

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